Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I'd like to know if there is some difference between using the Let statement for defining variables or simply omit it. On the official QlikHelp website there is an example like this:
Example Result
Set x=3+4; Let y=3+4; z=$(y)+1; | $(x) will be evaluated as ' 3+4 ' $(y) will be evaluated as ' 7 ' $(z) will be evaluated as ' 8 ' |
In addition to these examples, I've been doing tests by myselft and the both one seems to work exactly the same. The only difference I found out between defining or not a variable was that if you don't, It may be terminated either with a semicolon or end-of-line.
The Qlik Offcial Documentation also says that when you omit the word let, the statement then becomes a control statement. What I don't understand.
Is one option different to the another? And if they aren't, What's the best option to use?
Excuse the questions but I'm pretty new on Qlik Sense.
Hi, I have done some test and I don't see any difference using 'LET' or omiiting it. Anyway I will keep using LET to assign a calculated value in case future versions require the keyword.
I don't see how can affect than the synax is considered a control statement. Anyway I haven't found that in documentation (with a quick search), can you link where it says that?.
What I have found is that control statements may assign variable values, in example a for..next bucle assigns a differnt value to the same variable in each iteration.
CAn you link the offical documentt
Hi,
First of all thanks a lot for your reply and trying to help me. I drop the link below where you can find exactly this piece of text:
The word let may be omitted, but the statement then becomes a control statement. Such a statement without the keyword let must be contained within a single script row and may be terminated either with a semicolon or end-of-line.
I suggest to use always the regular statements because like Rubin mentioned they may one day not be optional anymore.
Unfortunately the Qlik help isn't very detailed in regard to omit the LET statement but the mention of being now a control-statement should be taken as a serious hint that's not the same to apply or to omit it. There is at least one general difference between them which I know and that's the validity. Normal defined LET/SET variables are always global while control-statements itself and there created variables or further nested control-statements have an own reduced validity.
Maybe there are here and there further hints within the Qlik help by the various control-statements to their special properties whereby I doubt that they would be very detailed in this case, too.
- Marcus
@Logistix So, on the Help page, what you can do is use the 'Did this information...' dialog at the bottom of the section in question to leave the Doc Team a note on what you feel is confusing etc., they are very good about looking at the comments that are submitted and trying to improve things, so I think this is our best avenue on this one to be sure things get updated to reflect better guidance. Let me know if you have questions, but hopefully it makes sense, may take a number of weeks, but they should update based upon what you provide in the way of feedback on things.
Cheers,
Brett