cancel
Showing results for 
Search instead for 
Did you mean: 

Prompt Variables into Script Logic

former_member266029
Participant
0 Kudos

Hello:

I want to pass dynamic values from prompt to script logic:

*XDIM_MEMBERSET INDICADORES=PORDIST,NAINDI,PORAJU,PORTOTAL

*XDIM_MEMBERSET LINEA=NALINEA

*WHEN INDICADORES

*IS PORDIST,PORAJU,PORTOTAL

*FOR %YEAR% = %anio%

*FOR %MONTH% = JAN,FEB,MAR,APR,MAY,JUN,JUL,AUG,SEP,OCT,NOV,DEC

*REC(FACTOR=-1, TIEMPO="%YEAR%.%MONTH%")

*NEXT

*NEXT

*ENDWHEN

*COMMIT

My variable is %anio%... If the user insert 2010 in the prompt, i Want 2010 to be there.

How can I do this?

This my package:

DEBUG(ON)

PROMPT(RADIOBUTTON,%CHECKLCK%,"Select whether to check work status settings when running logic.",1,{"Yes, check for work status settings before running logic","No, do not check work status settings"},{"1","0"})

PROMPT(TEXT,%anio%,"Elegir año",,"")

TASK(Execute formulas,USER,%USER%)

TASK(Execute formulas,APPSET,%APPSET%)

TASK(Execute formulas,APP,%APP%)

TASK(Execute formulas,SELECTION,%SELECTIONFILE%)

TASK(Execute formulas,LOGICFILE,%APPPATH%..AdminApp%APP%Copy - NA-Month.lgx)

TASK(Execute formulas,FORMULASCRIPT,"*FUNCTION LOGICPARAM=%anio%|")

TASK(Execute formulas,RUNMODE,1)

TASK(Execute formulas,LOGICMODE,1)

TASK(Execute formulas,CHECKLCK,%CHECKLCK%)

The error Messa ge is: Invalid Selection%

Thanks in advance

Luciana

Accepted Solutions (0)

Answers (3)

Answers (3)

JohnL
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Luciana,

Have a look at my answer in the following post:

You should get the general idea. If not, let me know.

Thanks,

John

Former Member
0 Kudos

Hi Luciana,

There are 2 problems in the advanced script.

First is that %SELECTIONFILE% is a temporary file which stores members of dimensions selected while executing DM. For populating these values, we need to use SELECTINPUT statement. However, you are not prompting to select any member of any dimension. Thus, your %SELECTIONFILE% is empty. So, you can remove this statement.

Secondly, you have prompted to enter a text. However, there is no statement to pass this variable to your script.

To keep it simple, you can prompt the user to select a time member using the prompt statement with SELECTINPUT. Once the user slects this, this value will be stored in the %SELECTIONFILE%. Your script can fetch the year value by using %YEAR% variable.

Hope this helps.

former_member1242110
Participant
0 Kudos

hi,

As your selection is the year from the time entered.

for that you have to maintain the "year" property in time dimension.

and by the selection statement you can have the year in variable.

*selection(%year1%,[ID],TIME,"ID = '%TIME_SET%'")

%year1% holds your year value in the above scinario

thanks,

Rajesh

former_member266029
Participant
0 Kudos

The error message is:

Execute formulasError

Invalid selection passed:

%SELECTIONFILE%

Thanks,

Luciana

Former Member
0 Kudos

Hi Luciana,

You have not used %DIMS% or SELECTINPUT or any option(with %DIMENSION_DIM%) to select members directly from the dimension member list. You have used a Text option to receive the input user. So nothing will be there in the SELECTION FILE. You must remove that line to avoid that error.

Karthik AJ

Former Member
0 Kudos

Hi Luciana,

Also in the script logic, you can must the LOGICPARAM instead of the %anio%, since the values are passed to the LOGICPARAM in the Formulascript property using the FUNCTION from the DM dynamic script.

Karthik AJ