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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Oliver_GER
Partner - Contributor II
Partner - Contributor II

Use a variable with decimals for arithmetic calculation in script

Hi,

I feel a little stupid asking this question - anyway I need your help with this.

SET ThousandSep='.';
SET DecimalSep=',';

let vVar = 8/7; //=1,1428571428571
trace vVar: $(vVar);

Table:
load
    $(vVar) * 10 as test
AutoGenerate 10;

 

What Qlik does here using dollar sign expansion is the following:

Table:
load
    1,1428571428571 * 10 as test
AutoGenerate 10;

And this is interpretated as this:

Table:
load
    1,
    1428571428571 * 10 as test
AutoGenerate 10;

 

So I end up getting a table with two fields. I tried to play around with different number formattings, but nothing works, because I do have to keep the accuracy of vVar.

Labels (1)
1 Solution

Accepted Solutions
tw_wipro
Partner - Contributor
Partner - Contributor

Hi Oliver,

what about this:

Table:
load
    $(vVar) * 10 as test
    ,'$(vVar)' * 10 as test2
AutoGenerate 10;

tw_wipro_1-1747851614005.png

 

View solution in original post

2 Replies
tw_wipro
Partner - Contributor
Partner - Contributor

Hi Oliver,

what about this:

Table:
load
    $(vVar) * 10 as test
    ,'$(vVar)' * 10 as test2
AutoGenerate 10;

tw_wipro_1-1747851614005.png

 

Oliver_GER
Partner - Contributor II
Partner - Contributor II
Author

THANK YOU! it was so easy. - I have to admit I do not fully understand, why qlik is still able to to calculate with it (it even works with timestamps) when we wrap it in single quotes, but it works. great!