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: 
_AnonymousUser
Specialist III
Specialist III

IF without ELSE

Hello,
In a tMap, I have want to do a test if without else :
field=toto?YES:<nothing>
Howcan I do that ?
Thank you for answers
Quartz
Labels (2)
8 Replies
Anonymous
Not applicable

Hi
You can set a default value or null or an empty string for ELSE case, there always be a value for the column even though it is null or empty.
Shong
Anonymous
Not applicable

Hi,
if you mean, that data is just mapped in the if case, u can enable the "expression filter" in the tMap component.
Regards,
M
chafer
Contributor
Contributor

Hello,
In a tMap, I have want to do a test if without else :
field=toto?YES:<nothing>
Howcan I do that ?
Thank you for answers
Quartz

Here is what I do to make a field hold a blank value versus a "null" value if value is a String/text:
field=toto ? YES : ""
Here is what I do to make a field hold a blank value versus a "null" value if value is Numeric:
field=toto ? YES : 0
_AnonymousUser
Specialist III
Specialist III
Author

Thank you, Shong,
But, if the value do not change, I want to keep the value original, and if I put it in the else, there is an error.
Have you try to do that ?
Thank you for the help ...
Quartz92
Anonymous
Not applicable

Hi Quartz,
i'm not sure what you exactly want to achieve. But if you want to stick with the old value in the ternary operation use the following:

field='toto'?<set_value_to_sth_else>:field
Regards,
M
_AnonymousUser
Specialist III
Specialist III
Author

Hi,
My problem is different :
In a tMap, with a test (xxx?www:ddd) I want modidy an output field with a value by testing an input field (output fiels is changed with input field or not (then, I keep original output field).
I do not see how I can do that ...
Thanh you for help,
Quartz
Anonymous
Not applicable

Hi,
ah now we're getting a bit clearer. As fair as i understand you will keep the value in your output attribute, but this value is not available in the input component you use (because it's loaded for example from another table).
So in this case you have to provide your output to the tMap as incoming stream. I would suggest the following
tInputXXX1_Check Table (row1)-->
tMap --> tOutput_Output Table (rowOutput)
tInputXXX2_Output Table (row2) -->
Now you can use the ternary operator following
rowOutput.Attribute = row1.Attribute=='someValue'?:row1.Attribute : row2.Attribute
When the if check fails, the existing value from the output component is used.
It might be helpful if you can add a screenshot of the job you modeled so far, then we can get a better understanding.
Regards,
M
_AnonymousUser
Specialist III
Specialist III
Author

Thank-you, mmeier
I did not think to use the same table un input and output.
I try ...
Quartz