Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Variable in Scripts

I  have created a variable in back end like

Let _Var = '=GetFieldSelections(Num_Month)';

Now i want to use it in my Load statement for example like below:

Load

ID,

Num_Month,

if($(_Var) = Num_Month,'Match','Not Match') as _Status

From Excel........

But i  am not getting the desired result .....????

Is it possble to use it like this ..........???

please help

6 Replies
Anonymous
Not applicable
Author

Hi manish05,

To use a variable, you have tu put it into $(), in your exemple:

Load

ID,

Num_Month,

if( $(_Var) = Num_Month,'Match','Not Match') as _Status

but as you have initialized your variable before the load, I suppose you the condition you want is:

if( Num_Month= $(_Var),'Match','Not Match') as _Status

Not applicable
Author

Still Not working

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Using a Let statement produces a string. So the variable expands to the string. Change that to a set without the quotes:

Set _Var = =GetFieldSelections(Num_Month);

(the double = signs are not a typo!)

This will produce a variable whose value is the field selection. I that what you are expecting?

Hope that helps

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Anonymous
Not applicable
Author

What is the complete script? Does the filed Num_Month exists in your excel file?

Actually, the function GetFieldSelections() is not available to be used in the script, so if you use GetFieldSelections() to set the variable in the script it won't work.

jonathandienst
Partner - Champion III
Partner - Champion III

But that will not produce useful value when used here.

If($(_Var) = Num_Month,'Match','Not Match') as _Status

What are you trying to compare with Num_Month?

Jonathan

PS and bobbyraj is right, GetFieldSelections does not work in script

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

But when i am using _Var in front end in the Text Obejct it is giving me the correct result , then why i can not use it in back end just below few lines after declaring the variable