Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Variable Tutorial and basic overview

Hi All,

I am looking for a resource that will serve as a foundation to understanding variables in Qlikview, when to use them, when to use Set vs Let, and how to use in formulas. I have found the below, but I was wondering if there is a better resource.

In my own script I am trying to create a variable that will store certain states that if shipped from a certain DC, would be classified as "over fence" shipments

My attempts that are failing:

Set vDC1OverFenceState= 'CA;OR;WA;ID;NV;AZ;AK;HI;UT;MT;WY;CO;NM;TX';

Set vDC2OverFenceState= 'ND;SD;NE;KS;OK;MN;IA;MO;AR;LA;WI;IL;KY;TN;MS;MI;IN;AL;OH;ME;NH;VT;MA;RI;CT;NY;PA;NJ;DL;WV;VA;FL;GA;SC;NC;MD;PR;VI';

IF(WH='DC1' and [SHIP TO STATE]= $(vDC1OverFenceState),1,0) as N7OverFence,

IF(WH='DC2' and [SHIP TO STATE]= $(vDC2OverFenceState),1,0) as L7OverFence,

I am thinking I need to use peek somehow, but something is missing in my logic. Any assistance appreciated.

Qlikview: Variables, SET, LET and Dollar Sign Expansion | Hyunku's Blog

9 Replies
sunny_talwar

Try this may be:

IF(WH='DC1' and Match([SHIP TO STATE], $(vDC1OverFenceState)),1,0) as N7OverFence,

IF(WH='DC2' and Match([SHIP TO STATE], $(vDC2OverFenceState)),1,0) as L7OverFence,


Not entirely sure if the set or let will work. Try the above with both let and set.


HTH


Best,

Sunny

marcus_sommer

Very good explanations will you find here:

The Magic of Variables

The Magic of Dollar Expansions

- Marcus

Anonymous
Not applicable
Author

Joe

Have a look at these 3 blog posts by hic‌.  His blog posts are always good.

The Magic of Variables

The Magic of Dollar Expansions

The Little Equals Sign

Not applicable
Author

Thank you all!

Not applicable
Author

Thanks Bill, Nice links

Not applicable
Author

If anyone is interested, here is how I got it to work. Thanks again for the excellent links.

SET vDC1OverFenceState= 'CA','OR','WA','ID','NV','AZ','AK','HI','UT','MT','WY','CO','NM','TX';

SET vDC2OverFenceState= 'ND','SD','NE','KS','OK','MN','IA','MO','AR','LA','WI','IL','KY','TN','MS','MI','IN','AL','OH','ME','NH','VT','MA','RI','CT','NY','PA','NJ','DL','WV','VA','FL','GA','SC','NC','MD','PR','VI';

IF(WH='DC1' and Match([SHIP TO STATE],$(vDC1OverFenceState)),1,0) as N7OverFence,

IF(WH='DC2' and Match([SHIP TO STATE],$(vDC2OverFenceState)),1,0) as L7OverFence,

sunny_talwar

That is exactly what I suggested .  You might have overlooked it.... But I am glad you got your solution...

Not applicable
Author

Yes thank you for the input! Still getting used to how and where to reply!

sunny_talwar

Hahahaha not a problem my friend