cancel
Showing results for 
Search instead for 
Did you mean: 

Script Logic Error

Former Member
0 Kudos

Can someone help me with this script logic. It gives error on REC statement saying that its an invalid instruction.

// Default base level logic - applies to all base members in all dimensions

*SELECT (%MBRS%,"ID","PRODUCT",[DUMMY]='PF1_D')

*XDIM_ADDMEMBERSET PRODUCT = %MBRS%

*XDIM_ADDMEMBERSET DATASRC = INPUTPER

*DESTINATION DATASRC=INPUT

*FOR %PRODUCT% = %MBRS%

REC(EXPRESSION=%VALUE%GET(DATASRC="INPUTPER",PRODUCT=%PRODUCT%),DATASRC="INPUT",PRODUCT=%PRODUCT%)

*NEXT

*COMMIT

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Ameya,

The rec expression will work with conjunction with when statement. So, please modify the script as below.

*FOR %PRODUCT% = %MBRS%

*WHEN PRODUCT

*IS %PRODUCT%

REC(EXPRESSION=%VALUE%GET(DATASRC="INPUTPER",PRODUCT=%PRODUCT%),DATASRC="INPUT",PRODUCT=%PRODUCT%)

*ENDWHEN

*NEXT

*COMMIT

Hope this helps.

Former Member
0 Kudos

Also, if you use a variable in a GET Statement, you should use " signs around the variable, like this: "%PRODUCT%" and make sure the variable has only 1 member in it (which you have done correctly using the for/next loop).

*FOR %PRODUCT% = %MBRS%

*WHEN PRODUCT
*IS %PRODUCT%
*REC(EXPRESSION=%VALUE%*GET(DATASRC="INPUTPER",PRODUCT="%PRODUCT%"),DATASRC=INPUT,PRODUCT=%PRODUCT%)
*ENDWHEN

*NEXT

*COMMIT

Edited by: Tim Vierhout on Apr 13, 2010 12:58 PM

Former Member
0 Kudos

Thanks guys for the prompt reply. That worked but I have a couple of other problems.

When I run the logic using logic debugger, it shows me the right results. But when I send data using Excel which runs the Default Logic with the calculation mentioned above, I see only the difference in the new amount and the old amount when I pull the result records using evdre.

For example, my original record is 100 and my new record (as a result of calculation) is 120. I see 20 when I create a report and not 120. Any idea if I need to add anything to the logic after or before commit.

Also there is another thing I wanted to do with the logic - As you can see above, I have fixed "DUMMY='PF1_D'" in the SELECT statement. However this has to be dynamic and 'PF1_D' should be the current product id of the record being processed. I tried something like this

*SELECT (%MBRS%,"ID","PRODUCT","DUMMY=PRODUCT.ID") but it gave an error. I am sure there has to be a way to read the dimension members of the record being processed.

Please let me know.

Thanks,

Ameya Kulkarni

Answers (0)