cancel
Showing results for 
Search instead for 
Did you mean: 

Do not create message or ignore error message if...

former_member69608
Participant
0 Kudos

Hi!

I got this target structure:

There can be many Items in TradeItemPrice. But if no Item is created I don't want to send the message.

Should I edit the mapping or make some expressen in receiver determination to handle this?

Accepted Solutions (1)

Accepted Solutions (1)

former_member69608
Participant
0 Kudos

There is an attribute called Price under Item. Problem is that if Price is 0 Item is not beeing created.

There has to be a way to check in RA if all segments of Item contains the attribute Price with value 0. How can this be done?

former_member184720
Active Contributor
0 Kudos

Have a look at the below blog -

You can find similar case : i.e. /p1:MT_Pickfile/Body[sum(field3) > 10000]

in your case you can check for sum(Price)>0 or even you can some other functions such as count etc.



former_member69608
Participant
0 Kudos

Hi Hareesh,

Yes, this works if there is only 1 occurence of the segment. My problem is that there are for example 5 segments of which 1 is with price 0.

If I choose the solution you suggested no message will be created. I want the 4 correct segments to generated the target structure.

former_member184720
Active Contributor
0 Kudos

Hi Stefan -

If you got 5 segment of which only 1 is of price "0" then then the Sum(price) will be >0 right?(the remaining segments will hold some value for Price attribute)

So the message will be routed to the receiver.

You'll also have to modify the mapping to filter the items whose price = 0.

Did i miss something?

former_member69608
Participant
0 Kudos

Ahaaaa! Smart!

I can't get it to work though. The message never gets routed whatever I fill in Price.

This seems right?

( /p1:MT_TradeItemPrice/Item/Price/RetailPrice/[sum(Amount)>0] EX )
former_member184720
Active Contributor
0 Kudos

Can you try with below ?

/p1:MT_TradeItemPrice/Item/Price/RetailPrice[sum(Amount)>0] EX

/p1:MT_TradeItemPrice/Item[sum(Price/RetailPrice/Amount)>0] EX

former_member69608
Participant
0 Kudos

Hello!

Thanks a lot Hareesh! It seems like the first option is working. I will be testing it more next week to make sure it really works.

Thanks again!

Answers (1)

Answers (1)

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Stefan,

The cardinality of Item is 1..unbounded, it will always get created at least once You can change it to 0..unbounded. For your scenario to work, you need to use enhanced receiver determination.

Regards,

Mark