Skip to Content
0
Former Member
May 20, 2016 at 12:42 AM

Select Statement Issue in Logic Script

127 Views

Hello Experts,

I would like to use logic script to copy data for some months from one year to another.

what I did is to input year(Version 2) or year.month(Version 3) from Time dimesion property YEAR(Version 2) or ID(Version 3) to get the Year code and then loop for the months which hardcoded as below.

However, only version 1 is working, but version 2 and version 3 got the same error when I ran from the package RUN_LOGIC:Invalid "select" statement.

I am sure that the statement like *SELECT(%TARGET_YR%, "[YEAR]", TIME, "[ID] = '$TARGET_YEAR$'") will not pass the validation in Logic Script, but it does work when you run the package.

Could someone help on it? Thank you very much for your kindly help in Advance

Wei

Logic Script Code:

//This LG is to copy data from A YEAR to ANOTHER

//Version 1 working well

//*SELECT(%SOURCE_YR%, "[YEAR]", TIME, "[ID] = 2006.01")

//*SELECT(%TARGET_YR%, "[YEAR]", TIME, "[ID] = 2009.01")

//Version 2 Not working, Error: RUN_LOGIC:Invalid "select" statement

//*SELECT(%SOURCE_YR%, "[YEAR]", TIME, "[YEAR] = '$SOURCE_YEAR$'")

//*SELECT(%TARGET_YR%, "[YEAR]", TIME, "[YEAR] = '$TARGET_YEAR$'")

//Version 3 Not Working, Error: RUN_LOGIC:Invalid "select" statement

*SELECT(%SOURCE_YR%, "[YEAR]", TIME, "[ID] = '$SOURCE_YEAR$'")

*SELECT(%TARGET_YR%, "[YEAR]", TIME, "[ID] = '$TARGET_YEAR$'")

*XDIM_MEMBERSET PRODUCT = ProductA

*XDIM_MEMBERSET ENTITY = CSO

*WHEN ACCOUNT

*IS *

*FOR %MONTHNUM% = .01, .02, .03

*REC(EXPRESSION = ([TIME].[TMVL(0,%SOURCE_YR%%MONTHNUM%)]),TIME = TMVL(0, %TARGET_YR%%MONTHNUM%),PRODUCT = %PRODUCT_SET%)

*NEXT

*ENDWHEN

*COMMIT

Data Manager Code:

PROMPT(SELECTINPUT,%SELECTION%,,"Select Target Product","PRODUCT")

PROMPT(TEXT, %SOURCE_YEAR%, "Enter the Source Year, e.g. 2006" , ,) //For Version 2

PROMPT(TEXT, %TARGET_YEAR%, "Enter the Target Year, e.g. 2007" , ,) //For Version 2

PROMPT(TEXT, %SOURCE_YEAR%, "Enter the Source Year.month, e.g. 2006.01" , ,) //For Version 3

PROMPT(TEXT, %TARGET_YEAR%, "Enter the Target Year.month, e.g. 2007.01" , ,) //For Version 3

INFO(%EQU%,=)

TASK(/CPMB/DEFAULT_FORMULAS_LOGIC,SUSER,%USER%)

TASK(/CPMB/DEFAULT_FORMULAS_LOGIC,SAPPSET,%APPSET%)

TASK(/CPMB/DEFAULT_FORMULAS_LOGIC,SAPP,%APP%)

TASK(/CPMB/DEFAULT_FORMULAS_LOGIC,SELECTION,%SELECTION%)

TASK(/CPMB/DEFAULT_FORMULAS_LOGIC,LOGICFILENAME,DATA_REPLICATION.LGF)

TASK(/CPMB/DEFAULT_FORMULAS_LOGIC,REPLACEPARAM, SOURCE_YEAR%EQU%%SOURCE_YEAR%)

TASK(/CPMB/DEFAULT_FORMULAS_LOGIC,REPLACEPARAM, TARGET_YEAR%EQU%%TARGET_YEAR%)