
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
SET VARIABLE AND IF STATEMENT IN LOAD SCRIPT
Hi all,
I'm trying to understand how to use un IF statement on a calculated ratio in the script editor. I have a table with two numeric fields/two measures, "[Pv One]" and "[Valore PV New]", and I know how to do a "flag variable" on their ratio in a pivot table (i.e. create an expression in this way -->
)
but I'm not be able to recreate this such of flag variable in the script editor. I thought to create first the ratio variable with a LET and then insert the IF statement within the load script of the table to create the flag variable -->
I have this error:
How should the script be modified to achieve this?
Thank you deeply
- Tags:
- loadscript
- qlikview
Accepted Solutions


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In the IF statement, did you try to use $(pv_ratio) instead of pv_ratio ?
/joseph


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your variable needs to be created with SET instead of LET because LET evaluated the content immediately and assigned just this result to the variable and did not contain the string. Like already mentioned you should use a $-sign expansion by calling the variable, like $(pv_ratio) to avoid that Qlik interpretes it as a field.
- Marcus


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In the IF statement, did you try to use $(pv_ratio) instead of pv_ratio ?
/joseph


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your variable needs to be created with SET instead of LET because LET evaluated the content immediately and assigned just this result to the variable and did not contain the string. Like already mentioned you should use a $-sign expansion by calling the variable, like $(pv_ratio) to avoid that Qlik interpretes it as a field.
- Marcus
