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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Difference between LET/SET

Hello !

I always confuse myself about using LET or SET or none of them.

Say that I want to create a NEW variable ? Do I use LET or SET ?

What about assigning a value to a variable ? Do I use LET/SET or nothing ?

Thanks !

13 Replies
Not applicable
Author

The file CREATION time is irrelevant.

The most important is the FILE NAME.

Cause the file from April/2009 may have been refreshed.

However, the chronological most old file is still November/2009.

So, on my script I do need November/2009, even though April/2009 may have been refresed (re-created).

Got it ?

As for LET/SET, is it correct to say this :

When you need a STRING VARIABLE ASSIGNMENT, use SET

When you need a NUMERICAL VARIABLE ASSIGNMENT, use LET

Is that correct ?

Anonymous
Not applicable
Author

About LET/SET - not exactly. May be it's also possible to assign a number with SET (SET var=0;), but I haven't tried.
The main LET role is to assign a result of some function or expression to a variable. The result of a function could be also string.

I understood you case with file names. We had a similar problem. It's near impossible to handle all posslible variants of month/date format in file names. That's why in our case we gave a strong recomendation to users to save file in defined format.

May be you can modify analytics what generates QVD files from CSV? If in CSV data is some Date field which can define month and year, then you can save QVD with file name you need. If the QVD name has to be the same as CSV then, as I mentioned, it's very difficult to create some "generic" code for this case.

Rgds,
Artjoms

Not applicable
Author

>>About LET/SET - not exactly. May be it's also possible to assign a number with SET (SET var=0;), but I haven't tried.
>>The main LET role is to assign a result of some function or expression to a variable. The result of a function could be also string.

OK.

Still dont have a strong clue on how to use one or another...

QV Team could be handy at this point ...

Are you hearing us ? Embarrassed

>>I understood you case with file names. We had a similar problem. It's near impossible to handle all posslible variants of month/date format in file >>names. That's why in our case we gave a strong recomendation to users to save file in defined format.

OK. I'lll think about it.

>>May be you can modify analytics what generates QVD files from CSV? If in CSV data is some Date field which can define month and year, then you >>can save QVD with file name you need. If the QVD name has to be the same as CSV then, as I mentioned, it's very difficult to create some "generic" >>code for this case.

The QVD file name is ALWAYS the same name as the CSV. For each and every CSV we have a QVD.

Maybe , when the file name has some sorting part on it , such as a date or a number, it could be always followed by an underscore or something similar. Then, a generic function could always substr on it.

I'll think about it. Not difficult to standardize since I'm the one who built the mainframe exctraction tool.

Thanks again. You're very kind.

Rgds,
Artjoms

Anonymous
Not applicable
Author

URW!

Good luck!