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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
_AnonymousUser
Specialist III
Specialist III

expression builder if, else

Hello,
I've got aquestion: Could I use in expression builder in tMap string value? If i write this (and I had verified that the row1.MessageName is really value ServiceModified), output from tMap is nothing..
row1.MessageName == "ServiceModified" ? row1.message : "nothing"
thanks for your answer
Karl
Labels (2)
13 Replies
Anonymous
Not applicable

Hello,
In java the correct expression is :

"ServiceModified".equals(row1.MessageName)? row1.message : "nothing"
_AnonymousUser
Specialist III
Specialist III
Author

Thank you very much. One more question please - if i want to do nothing in place of send to output string "nothing", could you give me advice once more please?
Karl
Anonymous
Not applicable

What do you mean by nothing ? You can send back an empty string by writing "" in place of nothing or null by typing null 0683p000009MACn.png
_AnonymousUser
Specialist III
Specialist III
Author

I don't want send anything except the case "ServiceModified".equals(row1.MessageName). I know if i place "" i send empty string (in my case to ibm mq). I want send a string only when the case is exactly matching my filter..
Anonymous
Not applicable

So return null.
"ServiceModified".equals(row1.MessageName)? row1.message : null
_AnonymousUser
Specialist III
Specialist III
Author

if i write "ServiceModified".equals(row1.MessageName)? row1.message : null in case that doesn't match my filter i have got in ibm mq queue message with data null. I don't want send no message in this case...maybe its problem with my english 0683p000009MPcz.png
Anonymous
Not applicable

Hi Karl32,
I already experienced that kind of logic and it made me cry 0683p000009MACn.png what I did is, I didn't put my condition in tMap expression builder, i used the tFilterRow(I filter out first those data that satisfy my condition) then connect to tMap. Because I think, only one line "If" statement can be done in tMap expression builder. I hope you got my point.
Regards,
Anonymous
Not applicable

So, in tMap I can't filter by conditions and decided if message was sent or not? in attachment you can see my case. mominput (xmlmessage) - some balast - parsing xml - filtering by parsed conditions - sending messages by sorted conditions (if condition1 = 1 send to queue1, if condition1 = 2 send to queue2 etc). In this case ("condition".equals(row1.MessageName)? row1.message : null) is happening that the message was send to all queues. My goal is to send only to one queue that meet my conditions.
Anonymous
Not applicable

hi,
why don't use the filter integrated in tMap?
only row1.value .equals(context.MessageName) will be "propagated".
result :
Démarrage du job filterMap a 09:29 16/07/2010.
connecting to socket on port 3537
connected
1|100
disconnected
Job filterMap terminé à 09:29 16/07/2010.

regards
laurent