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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
_AnonymousUser
Specialist III
Specialist III

Ternaire condition

Hello,
Is it possible to have, in a tMap, a ternaire condition as :
toto=1?Var.cptY+1 and "YES":Var.cptN+1
-----------------------
ie two actions il a ternaire condition.
Thank-you for answers
Quartz
Labels (2)
6 Replies
Anonymous
Not applicable

Hi,
In the tmap, the formula must return a value that will be assigned to the output column of your schema. Then, you can't use if/then/else statements in it.
Instead, use conditional operator "?" like this :
(condition) ? then_value : else_value
That is the ternaire condition
Best regards
Sabrina
_AnonymousUser
Specialist III
Specialist III
Author

Hello,
Yes, but
(condition) ? then_value : else_value
in the then_value, (or in the else_value or the both), is it possible to have two actions, one who assign a value in the output column, and another as cpt+1 to display it after ?
Best regards,
Quartz
Anonymous
Not applicable

Hi,
in the then_value, (or in the else_value or the both), is it possible to have two actions, one who assign a value in the output column, and another as cpt+1 to display it after ?

Could you please elaborate your case with an example with input and expected output values?
Best regards
Sabrina
_AnonymousUser
Specialist III
Specialist III
Author

Sabrina,
In a tMap, I have this expression to assign a value in output column :
!Relational.ISNULL(File_Ei.NAME)?File_Ei.Name:"NoName"
and (in more) I want count how many input null and no null I have.
Can I do :
!Relational.ISNULL(File_Ei.NAME)?File_Ei.Name Var.cptnoNull+1:"NoName" Var.cptNull+1
for displaying the two counters after, in an another steep.
More generally, is it possible to have more than one action in then_value or/and else_value in a ternaire condition ?
Thank you for answer ...
Quartz
Anonymous
Not applicable

Hi,
I think the Ternaire condition in tMap cannot achieve that.
But you create a routine to do it Managing routines
for example:
condition? MyRoutine.methodIfTrue():MyRoutine.methodIfFalse()

and you can define a variable in the routine that is accessable from the same job or other job
Can I define a variable that is accessible from multiple Jobs?
Best regards
Sabrina
_AnonymousUser
Specialist III
Specialist III
Author

Thank you, Sabrina
Qartz92