Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
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
daveamz01
Contributor III

Re: scripting question assign variable

Hi,

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


Regards,

David

5 Replies

Re: scripting question assign variable

Try with

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

daveamz01
Contributor III

Re: scripting question assign variable

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

Re: scripting question assign variable

The result here is: [Product_=Language]

Unfortunaltely not the outcome I am looking for.

Thanks

thornofcrowns
Valued Contributor II

Re: scripting question assign variable

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

Re: scripting question assign variable

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

Community Browser