Qlik Community

Ask a Question

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
Join us for a live Q&A! September 21, 10 AM ET - Onboarding Fast in Qlik Sense SaaS! REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
HeinriG
Contributor III
Contributor III

Dividing field by any number returns null

Hi,

I've been really stuck with this problem, the DefaultValue field returns the correct value (1.5) if no division is done but returns null if I divide by 24.0 (or any number).   If I enter 1.5/24.0 in its place it also returns the correct value, so I'm not at all sure whats going on. Any help would be much appreciated.

Here is the line from the script (just for clarity, the problem only occurs for rows that contain 'hrs' and make the if return true):

if(WildMatch(Description, '*hrs*'),DefaultValue/24.0,DefaultValue) as Target

Please let me know if you need more information, thank you.

Labels (4)
1 Solution

Accepted Solutions
crusader_
Partner
Partner

Hi,

Well, most likely your DefaultValue is just a text, try explicitly to convert it to numeric with num#(DefaultValue) function.

If the number has certain format, specify it like NUM#(DefaultValue,'#,###.00')...

You can quickly understand if it's a text or number by looking at it in table viewer (preview): if it's aligned to the right = number, to the left = text.

Hope this helps.

//Andrei

View solution in original post

5 Replies
HeinriG
Contributor III
Contributor III
Author

I just checked, the same thing happens when I simply load:

DefaultValue/2 as Test

It just returns a column filled with null values
crusader_
Partner
Partner

Hi,

Well, most likely your DefaultValue is just a text, try explicitly to convert it to numeric with num#(DefaultValue) function.

If the number has certain format, specify it like NUM#(DefaultValue,'#,###.00')...

You can quickly understand if it's a text or number by looking at it in table viewer (preview): if it's aligned to the right = number, to the left = text.

Hope this helps.

//Andrei

View solution in original post

HeinriG
Contributor III
Contributor III
Author

Hi Andrei,

That worked perfectly, thank you so much! Never even though of that.

 

crusader_
Partner
Partner

Check your system variables

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

I suspect your DefaultValue has different to your settings...

//Andrei

HeinriG
Contributor III
Contributor III
Author

I did try that earlier but it didn't seem to work for whatever reason. But with the num#() I can be sure it works.

Thank you!