Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a customer, who has lots of expressions in qvw file and then they have about 5 different qvw per this topic. So I thought to make one txt file about expressions and then I will read that into each of these qvw's.
But I have a problem. I made a very simple qvw about this.
Attached qvw includes this script:
SET vv_max_year=max(Year);
LET v_max_year='='&vv_max_year;
SET v_sum_max_year = num(sum({$<Year={'$(v_max_year)'}>} sum_field)/1000, '# ##0');
My idea is that at the final result I have a variable called v_sum_max_year, which value is
num(sum({$<Year={'$(v_max_year)'}>} sum_field)/1000, '# ##0');
But, after reload the value is
num(sum({$<Year={'=max(Year)'}>} sum_field)/1000, '# ##0')
The script replaces the $(v_max_year) with a value of that variable. This sounds good, but this doesn't work. Is there a possibility to write the this so that script wouldn't replace $(var) with a value where we reference.
These SET's and LET's are definitely not my best knowledge area at QlikVIew
Hi TOA,
You are using LET and SET the other way around.
SET will set a string value to a variable. For example:
SET x = 3+4; --> in this case the valuo of x $(x) is '3+4'
Now if we use LET, the expression 3+4 will be evaluated:
LET y = 3+4; in this case the value of y $(y) will be 7.
So in your script change it soit looks like this:
LET vv_max_year=max(Year);
SET v_max_year='='&vv_max_year;
LET v_sum_max_year = num(sum({$<Year={'$(v_max_year)'}>} sum_field)/1000, '# ##0');
Hi,
Thanks for your reply. I changed the script like this and I get an "Script error" when reloading.Script editor shows that there are something wrong with the last LET's set analysis (it doesn't undestand the character '{')