cancel
Showing results for 
Search instead for 
Did you mean: 

Using Date functions in DP macros

Former Member
0 Kudos

Hi all,

I am currently developing a macro in DP...and I need to do an action for the first period of a year.

I need to identify the first period for this purpose..I m using the date function Bucket_fiscal_period for this purpose but for soem reasons it is not giving a value of 01 for the first period.

The planning bucket has a weekly bucket pattern.

I tried to use the layoututvariable_set + layoutvariable and then bucket_fiscal_period to try and see if the values are getting set.But this seems not to be happening.

Can anybody tell me whats wrong here?

Thanks and Regards,

Anu

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello,

If I am understanding your issue correctly you are trying to identify the weekly bucket in which the first day fo the year falls. To accomplish the same I guess the following should work:

OPTION 1:

IF

WEEK ( DATE ( BUCKET_BDATE ( X ) ) = 1

THEN

LAYOUTVARIABLE_SET ( 'FIRSTDAY' )

ENDIF

OPTION 2:

IF

YEAR_BDATE ( WEEK_BDATE () ) >= WEEK_BDATE ()

AND

YEAR_EDATE ( WEEK_BDATE () ) <= WEEK_BDATE ()

THEN

LAYOUTVARIABLE_SET ( 'FIRSTDAY' )

ENDIF

Hope this helps.

Regards,

Abhi

Former Member
0 Kudos

Hi Abhi,

I tried option 1 by doing following

LAYOUTVARIABLE_SET( 'VAR' ;

WEEK(DATE(BUCKET_BDATE(

Row: Marketing Forecast ( Frm P 42/2008)

)

)

)

and then

Row: Marketing Forecast ( Frm P 42/2008) =

Layoutvariable( 'VAR' )

But it doesnt work

Former Member
0 Kudos

Hi,

I have not had the opportunity to check the macro fully, but I would advise you to attempt retrieving the value of the layout variable using layou_var_value() instead of layoutvariable().

Let me know whether it works.

kind regards,

Eric

Former Member
0 Kudos

Hey Abhi,

The problem is solved now.

I had mistakenly chosen the data source of the argument row as Values instead of Column attribute.

I can now successfully get the period for a bucket.

Thanks for the help aneways!

Regards,

Anuradha