expression builder if, else

One Star

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
Employee

Re: expression builder if, else

Hello,
In java the correct expression is :

"ServiceModified".equals(row1.MessageName)? row1.message : "nothing"
One Star

Re: expression builder if, else

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
Employee

Re: expression builder if, else

What do you mean by nothing ? You can send back an empty string by writing "" in place of nothing or null by typing null Smiley Happy
One Star

Re: expression builder if, else

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..
Employee

Re: expression builder if, else

So return null.
"ServiceModified".equals(row1.MessageName)? row1.message : null
One Star

Re: expression builder if, else

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 Smiley Sad
One Star

Re: expression builder if, else

Hi Karl32,
I already experienced that kind of logic and it made me cry Smiley Happy 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,
One Star

Re: expression builder if, else

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.
Seventeen Stars

Re: expression builder if, else

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
One Star

Re: expression builder if, else

I'm sorry, but i think I'm little blocked. I want to send field "message" by filtering field "MessageName" to various queues as you can see in my case. I want to use filter in tMap, I had defined variables, but I can't get your point Smiley Sad
One Star

Re: expression builder if, else

currently i do it with tFilterRow. I cannot find a way to do this with condition in expression builder in tMap. Thanks all.
Seventeen Stars

Re: expression builder if, else

ok,
do it step by step Smiley Happy
first we got some different value "in" and compare with context.messageName.
In the output flow , first we catch the flow where equals context.messageName. (tlogrow 1)
second we reject those who don't match ... (reject context message)
But we also can add another filter to those output flow (tlogrow 2 3)
and so on Smiley Happy
Note difference between reject of input flow and reject of the filters designed in the output schema.
hope it helps
regards
laurent
One Star

Re: expression builder if, else

Thanks a lot!!!!