cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping

Former Member
0 Kudos

Hi All,

My source xml has the fields

1. header key

2. item key

3. quantity

4. cheader key

5. citem key

6. cquantity

The first 3 fields are from one table and the next 3 fields are from another table. During mapping, I have to check 3 conditions.

1. Does cheader key, citem key, cquantity fields contain elements( a record may not be available), if not map it to target msg.

2. If there is a record such that header key, cheader key and item key,citem key matches and quantity and cquantity alone differs(quantity > cquantity), find quantity-cquantity(difference) and map it with target.

3. If all 3 header key, item key, item key, quantity matches cheader key, citem key, cquantity send a mail.

How can this be achieved.

Kindly let me know your suggestions on this.

Any help is highly appreciated.

Thanks & Regards,

Jai Shankar.

Accepted Solutions (1)

Accepted Solutions (1)

bhavesh_kantilal
Active Contributor
0 Kudos

Jai,

><i>1. Does cheader key, citem key, cquantity fields contain elements( a record may not be available), if not map it to target msg.</i>

Use the Node Function EXISTS to check for the existence of a field in the source.

><i>If there is a record such that header key, cheader key and item key,citem key matches and quantity and cquantity alone differs(quantity > cquantity), find quantity-cquantity(difference) and map it with target</i>.

Use EXISTS plus Simple UDF

<i>3. If all 3 header key, item key, item key, quantity matches cheader key, citem key, cquantity send a mail.</i>

Multi mapping. Check for condition and if yes, then create the mail interface and send mail.

Regards,

Bhavesh

bhavesh_kantilal
Active Contributor
0 Kudos

Jai,

On second thoughts, the 3rd question for sending mail..

Check if you can do this using Conditional Receiver or Interface Determaintion.

Regards,

Bhavesh

Former Member
0 Kudos

Thanks for the fast response.

Simple UDF --> I heard UDFs can take in strings and return a string, but here both quantity and cquantity are decimals. Can I use a UDF here??

Thanks & Regards,

Jai Shankar.

bhavesh_kantilal
Active Contributor
0 Kudos

Jai,

Yes they take only Strings . But even a decimal value like 23.04 is a String right? In the sense, when they are passed to the UDF, they are converted to String "23.04"

In your UDF, write the logic to convert this String into a decimal value and do the comparison .

Regards,

Bhavesh

Former Member
0 Kudos

Bhavesh,

Thanks a lot for the ideas. I l have to avoid a BPM here as far as possible. Yes, got to check whether I can send the mail with conditional receivers.

Thanks again.

Regards,

Jai Shankar.

bhavesh_kantilal
Active Contributor
0 Kudos

Jai,

It should be possible without BPM.

Just take a look at this blog on how XPATH can be used,

/people/shabarish.vijayakumar/blog/2005/08/03/xpath-to-show-the-path-multiple-receivers

/people/shabarish.vijayakumar/blog/2006/06/07/customise-your-xpath-expressions-in-receiver-determination

Regards,

Bhavesh

Answers (1)

Answers (1)

Former Member
0 Kudos

Any comments on this pls...

Thanks & Regards,

Jai Shankar.