Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
intervigilium
Contributor III
Contributor III

Set format variable

In the script i convert some strings to a number, where " . " is the decimalseperator.

That works fine.

If i want to calculate with it, it transforms back to " ,  " as decimalseperator. Tried anything without succes, should be simple i think

In script from string to number i used:

    Num#(X_LL,'#.#', '.' , ',') as longitude,

Num#(Y_LL,'#.#', '.' , ',') as latitude

I works fine.

But after calculating the median it comes with an " , "

var_mid_lat=median(latitude);

If i add a textbox with the following code:

=num#((var_mid_lat), '#.##', '.' , ',')

It gives back the correct value.

How to combine both so the variable format is correct?

For example i would expect something like:

in the variable:

var_mid_lat     = '=num#(median(latitude),'#.#' , '.' , ',' )';

But this is not working, wrong syntax

1 Solution

Accepted Solutions
vishsaggi
Champion III
Champion III

In your main script near environment set variables change this like below: And run your script again

ThousandSep as Comma and DecimalSep as Dot. .

SET ThousandSep=',';

SET DecimalSep='.';

View solution in original post

3 Replies
Anil_Babu_Samineni

May be doing Replace

LET var_mid_lat     = num#(Replace(median(latitude),'.' , ',' ),'#.#');

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
vishsaggi
Champion III
Champion III

In your main script near environment set variables change this like below: And run your script again

ThousandSep as Comma and DecimalSep as Dot. .

SET ThousandSep=',';

SET DecimalSep='.';

intervigilium
Contributor III
Contributor III
Author

Hi Anil and Vishwarath,

Thanks for your help!

The answer of Vishwarath did solve the problem. The syntax of your solution Anil gives an error (dont know why). Next time i will add the excel, so you can reload the script.

THanks again for all your help!!