Skip to Content

Sometimes you need to execute part of your script logic code depending on some member existing in the scope. For example, you need to execute some CALCACCOUNT rule only if you have CATEGORY Budget in scope. Scope can be defined as a result of DM package prompt or can be initial scope for default.lgf.

Somebody may think that the following code will perform the test:

*SELECT(%TEST%,ID,CATEGORY,ID=%CATEGORY_SET% AND ID=Budget)
*FOR %T%=%TEST%
*XDIM_MEMBERSET CATEGORY=%T% //Just for test
//Place your code here
*NEXT

But due to the old bug, if we have two or more “=” conditions for the same property (ID in this case) “AND” is treated as “OR”.

The following code will do the job:

//%CATEGORY_SET%=Actual,Budget
*SELECT(%NOTTEST%,ID,CATEGORY,ID=%CATEGORY_SET% AND ID<>Budget) //%NOTTEST%=Actual
*SELECT(%TEST%,ID,CATEGORY,ID=%CATEGORY_SET% AND ID<>%NOTTEST%) //%TEST%=Budget
*FOR %T%=%TEST% //Single execution of the loop
*XDIM_MEMBERSET CATEGORY=%T% //Just for test
//Place your code here
*NEXT

Result in UJKT:

LGX:

*XDIM_MEMBERSET CATEGORY=Budget

If Budget is missing in the scope:

//%CATEGORY_SET%=Actual
*SELECT(%NOTTEST%,ID,CATEGORY,ID=%CATEGORY_SET% AND ID<>Budget) //%NOTTEST%=Actual
*SELECT(%TEST%,ID,CATEGORY,ID=%CATEGORY_SET% AND ID<>%NOTTEST%) //%TEST%=Empty
*FOR %T%=%TEST% //Nothing will be executed
*XDIM_MEMBERSET CATEGORY=%T% //Just for test
//Place your code here
*NEXT

Result:

LGX:


Questions? Comments?

To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

  1. Leila Lappin

    Hi Vadim,

     

    Thank you for your contribution.  Just like your other contributions, I am sure this will help many BPC users.  Thank you again.

    Best Regards,

    Leila Lappin

    (1) 

Leave a Reply