cancel
Showing results for 
Search instead for 
Did you mean: 

[Help] DP Macro to shift values from one row to another based on Lead-Time

marc_laberge
Participant
0 Kudos

Hi Experts,

I'm trying to create a macro that would pull values from one row and transfer them (backwards) in another based on the Lead Time of a product.

I know how to get the lead time in days from the Product with the MATLOC function :

LAYOUTVARIABLE_SET('LT' ;
MATLOC('CHKHOR' ; ACT_PRODUCT ; ACT_LOCATION ; ACT_VERSION
)
)

I'm thinking of using the TIMESHIFT_BACKWARDS function, but I don't know exactly how to use it.

I'm guessing I would have to convert my lead-time from Workdays to Weeks (my planning book is in weeks) ?

Also that would mean the macro wouldn't be really flexible and only usable in a Week Bucket format.

Is there a way to make a shift only based on date and not Time Buckets ?

Thanks,

Marc

Accepted Solutions (0)

Answers (3)

Answers (3)

marc_laberge
Participant
0 Kudos

The thing that was messing it up for me was the Area vs Row items.

You have to have two Rows I think :

1. Row with the values you would like to shift.

2. Row with the shift values.

Then in the TIMESHIFT function you have to use these rows inside Areas.

Here what it looks like for me now and it works.

Fill Auxiliary Table : ( 105 Iterations :Initial; W 10.2011 )
      Row: Time_Buckets ( Frm Initial ) =
        LAYOUTVAR_VALUE( 'TB' )
    Time_Shift : ( 1 Iterations :Initial;Initial )
      Area: Agrolante Production ( Initial ) =
        TIMESHIFT_BACKWARDS(
        Area:  [ $Agrolante Receptions ( Initial ) ; $Agrolante Receptions (  W 10.2011 ) ]
        Area:  [ Time_Buckets ( Initial ) ; Time_Buckets (  W 10.2011 ) ]
        )

marc_laberge
Participant
0 Kudos

Well, I'm making progress, but my TimeShift function doesn't want to work. For some reason it just delete my values.

Here is what I have right now, am I doing something worng ?

Macros in the Macro Book
Get_Lead_Time
  Copy Receptions : ( 105 Iterations :Initial; W 09.2011 )
    Row: Agrolante Production ( Frm Initial ) =
      Row: Agrolante Receptions ( Frm Initial )

  Get Lead_Time : ( 1 Iterations :Initial;Initial )
    IF
      DET_LEVEL = 1
        DET_LEVEL('AGRO_FR')= 1
      
      Get Lead_Time
        LAYOUTVARIABLE_SET( 'LT' ;
        MATLOC( 'CHKHOR' ;
        ACT_PRODUCT ;
        ACT_LOCATION ;
        ACT_VERSION
        )
        )
    ENDIF
  
  Get Nb of Days in Time Buckets : ( 1 Iterations : W 11.2009; W 11.2009 )
    IF
      DET_LEVEL = 1
        DET_LEVEL('AGRO_FR')= 1
      
      Get Nb of Days
        LAYOUTVARIABLE_SET( 'NB' ;
        BUCKET_DAYS(ACT_COLUMN)
        )
    ENDIF

  Calculate Nb of Time Buckets : ( 1 Iterations :Initial;Initial )
    IF
      DET_LEVEL = 1
        DET_LEVEL('AGRO_FR')= 1

      Calculate Nb of Time Buckets
        LAYOUTVARIABLE_SET( 'TB' ;
        LAYOUTVAR_VALUE( 'LT' )
        /  
        LAYOUTVAR_VALUE( 'NB' ) ;
        0
        )
    ENDIF

  Fill Auxiliary Table : ( 105 Iterations :Initial; W 09.2011 )
    Row: Time_Buckets ( Frm Initial ) =
      LAYOUTVAR_VALUE( 'TB' )

  Time_Shift : ( 52 Iterations : W 10.2010; W 09.2011 )
    Row: Agrolante Production ( Frm  W 10.2010 ) =
      TIMESHIFT_BACKWARDS(
      Row: Agrolante Production ( Frm  W 10.2010 )
      Row: Time_Buckets ( Frm  W 10.2010 )
      )

Former Member
0 Kudos

I have been trying to use use the same function TIMESHIFT_BACKWARDS. It deletes the values for me. Please let me know if you could find a fix.

Former Member
0 Kudos

Hi

Even i am looking for same solution.

In our case we have Long Transitit times to the Customer, based on that demand need to shift backword wrt Product & Customer Combination in DP.

Thanks