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

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
AndyBrown
Contributor
Contributor

If/Then in tMap with Long Value

I've got a long value coming over in a tFileDelimitedInput lookup defined as a long. I want to forward a null value to the output if the value is null. Currently the value defaults to 0 if the lookup doesn't exist.
I know I can use this expression for a string...
stringvalue == "value" ? "true_value" : "false_value"
But I'm getting an error on the long value. I tried...
longvalue == null ? null : longvalue
Thanks.
Labels (2)
3 Replies
Anonymous
Not applicable

Helllo
But I'm getting an error on the long value. I tried...

if you uncheck the 'nullable' option on schema, this column is not object type, so you can't the following expression:
row1.colName==null?null:value1
What you could do is:
a)Check the 'nullable' option and use expression: row1.colName==null?null:value1.
b)Using the folllowing expression:
row1.colName==0?setAFixedValueReplace0:row1.colName

Best regards
shong
AndyBrown
Contributor
Contributor
Author

I guess the value coming over is "0" due to the condition you described on the input I had. Thanks for the assistance.
_AnonymousUser
Specialist III
Specialist III

I'm trying to do something similar:
I am reading an int value in tFileInputXML.
If the XML field is not there, the value is null and I want tmap to pass the null value to the output (xls).
If it is not null, then I want to divide by 10 and output the results as a double.
Relational.ISNULL(row1.colName)?null 0683p000009MPcz.png(double)(row1.colName) / 10)
If I check the "Nullable" in the tFileInputXML, then I get a null pointer exception?
Same problem if I use row1.colName==null?null 0683p000009MPcz.png(double)(row1.colName) / 10)