Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Variable Being Overwritten?

Hi Folks

Odd situation happening on a production QlikView document.

I have a variable that is declared/defined in the LOAD Script with the following statement:

SET vCompDate = "=GetFieldSelections(DT_ComparisonDate)";


So, normally when I use this variable it used in a dollar expansion within a set analysis expression, and the dollar expansion obviously produces a date value, the date value will of course change according to the selections made against the field DT_ComparisonDate.

An odd problem happens very in-frequently whereby the comparison date selections stop working, and actually what has happened is that the variable vCompDate has changed to contain a date value rather than the above statement.

I have looked through macros and there is nowhere where this could possibly happen in a macro, so I'm wondering if anybody else out there has come across this behaviour at all, and if so, have you tracked the root cause?

Cheers,

7 Replies
Not applicable
Author

I could still use some assistance on this if anybody has any ideas.

sparur
Specialist II
Specialist II

Hello, Nigel.

I created a small example and I don't see the same behaviour.

see in attachment, please.

Not applicable
Author

Hi

Yes, I normally don't see any problems with it, it just happens every now and again (happened once about 3 months ago, and again yesterday) so it's not an everyday problem.

One thing.....

You used LET vCompDate = ......................

I have used SET vCompDate = .......................

I have never been absolutely clear on the difference between the two, but maybe that might be causing the problem?

sparur
Specialist II
Specialist II

When a long time ago, I tried describe differences between these two definitions of variables: http://qvrus.blogspot.com/2009/09/qlikview.html. See in my blog (it's on Russian but you can use a google translate option, which built-in in my blog.)

But when your definition like as:

SET vCompDate = "=GetFieldSelections(DT_ComparisonDate)";

so I think that no differences, because you use symbol equal and your variable must be evaluate

Not applicable
Author

The difference between let and set are well explained in the Qlikview help

The Set command assigns the variable the text to the right of the equal sign, whereas the Let command evaluates the expression.

Both are really different and do not give the same result.

Hope that helps.

Philippe

sparur
Specialist II
Specialist II

you can use this version of my example for understanding differences

sparur
Specialist II
Specialist II

Yes, Philippe.

but if we use equal sign in the value of variable (SET vCompDate = "=GetFieldSelections(DT_ComparisonDate)";), then all differences no more exists.

In the Nigel's example, we see that he use equal sign.