Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
chriys1337
Creator III
Creator III

Calculated Variable

Hi,

I would like to hand over the value of one variable to another, and tried it with following let statement, which does not work?

(vCountry_Count = 1)

LET vPeeking = $(vCountry_Count);

Additinal question, once this is working I would like to  deduct -1 from Country_Count in the vPeeking Variable.

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

(vCountry_Count = 1)

is not a valid script statement and will return a null result. A valid statement would be without the () and an added; 

vCountry_Count = 1;

This defaults to LET and I recommend you explicitly code either LET or SET.  There is no need to favor LET over SET unless you are calculating an expression.  So a valid set of statements would be:

SET vCountry_Count = 1;
SET vPeeking = $(vCountry_Count);

And to subtract 1 from vPeeking:

LET vPeeking = $(vPeeking) - 1;

-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com

 

View solution in original post

2 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

(vCountry_Count = 1)

is not a valid script statement and will return a null result. A valid statement would be without the () and an added; 

vCountry_Count = 1;

This defaults to LET and I recommend you explicitly code either LET or SET.  There is no need to favor LET over SET unless you are calculating an expression.  So a valid set of statements would be:

SET vCountry_Count = 1;
SET vPeeking = $(vCountry_Count);

And to subtract 1 from vPeeking:

LET vPeeking = $(vPeeking) - 1;

-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com

 

Anil_Babu_Samineni

Perhaps this?

Set vCountry_Count = 1;

LET vPeeking = $(vCountry_Count)-1;

 

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful