Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

scripting question assign variable

Hi all,

I have the following:

a variable defined in the script: set vLanguage '=Language';

a variable vProduct defined with the menu options 'settings varaibale overview'  =chr(91)&'Product' &chr(95) & '$(vLanguage)' & chr(93)

This all works works fine and gives me the result I am looking for.

However I am curious how to add the variable vProduct in the script.

set vLanguage = '=Language';

set vProduct = =chr(91)&'Product' &chr(95) & '$(vLanguage)' & chr(93);

The result here is in the variable vProduct:  =chr(91)&'Product' &chr(95) & '=Language' & chr(93)

My question is: How to write the script in such a way that the variable vProduct is equal to : =chr(91)&'Product' &chr(95) & '$(vLanguage)' & chr(93)

Thanks in advance,

Gerrit

1 Solution

Accepted Solutions
daveamz
Partner - Creator III
Partner - Creator III

Hi,

LET vProduct = '=chr(91)&'&chr(39)&'Product' & chr(39) & ' & chr(95) & '& chr(39)& CHR(36) &'(vLanguage)' & chr(39) & ' & chr(93)';


Regards,

David

View solution in original post

5 Replies
alexandros17
Partner - Champion III
Partner - Champion III

Try with

LET vProduct = chr(91)&'Product' &chr(95) & '$(vLanguage)' & chr(93);

daveamz
Partner - Creator III
Partner - Creator III

Hi,

LET vProduct = '=chr(91)&'&chr(39)&'Product' & chr(39) & ' & chr(95) & '& chr(39)& CHR(36) &'(vLanguage)' & chr(39) & ' & chr(93)';


Regards,

David

Not applicable
Author

The result here is: [Product_=Language]

Unfortunaltely not the outcome I am looking for.

Thanks

ThornOfCrowns
Specialist II
Specialist II

As an aside;

Set: Assigns the value (or expression which is after the equal sign) as it is without compututation.

Let: Calculates the expression assigned to it and sets the expression result to the variable.

 
Example:

     Set vMyVar=2+3; 

     vMyVar has the expression 2+3 as value we have to compute it using $(vMyVar) which returns 5

   

     Let vMyVar=2+3;

     vMyVar has the computed value 5

Not applicable
Author

David,

Your solution works fine.

It's still a bit hard to understand what exactly is happening but I am working on that .

Thank you very much.

Gerrit