cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping based on condition

Former Member
0 Kudos

Hi all

I have a small query

I have a source file which contains the record type, customer number, contract number as one record and material type, value, and date in the next record.

the file format is something like this

H,1000,59034

D, 4545,3499

If the first value in the record is 'H', then the values in that record should be mapped to customer and contract no. in the target and if it is 'D', then the values should be mapped to the material number and value fields in the target. (Here I have created entries for all customer, contract , material and value in the source file.)

Could anyone please help me out in this issue?

Thnx in advance

Hari

Accepted Solutions (1)

Accepted Solutions (1)

henrique_pinto
Active Contributor
0 Kudos

Answers (6)

Answers (6)

Former Member
0 Kudos

hi,

This can be done in graphical mapping itself.

Use ifWithoutElse function from Boolean functions wherein you can check if value is H then map next two fields from source with customer number and contact.

If the value is D then map otherwise.

Is your customer and contract no,material type, value have occurance 0 ?

Regards.

Former Member
0 Kudos

Hi Hari,

Sorry for the wrong url.

Please check

<u>

Cheers!

Samarjit

Former Member
0 Kudos

Hi Hari,

First user content conversion for file delimeter.

<u>

Create your own UDF that if "H" come then First data go to customer and second data go to contract no, if "D" then else.

Cheers!

Samarjit

prateek
Active Contributor
0 Kudos

Hi Hari,

U have 2 options:

1. Go for simple message mappings

2. Go for UDF

Option 1 - Seems easy but the mapping could become complex with no of "if " statements equals to no of fields to check.

Option 2 - Though u have to write a UDF here, but then the code inside UDF ll b much easier to implement

So in my opinion, u should go for UDF

<i>

[Reward if helpful]</i>

Regards,

Prateek

Former Member
0 Kudos

Hari,

Create a flat structure and map all individuals fields using the IF function in XI using the substring option. It is straight forward. Also if you want the output depending on the number of D's then map the D to root of the target message.

---Satish

prabhu_s2
Active Contributor
0 Kudos

pass H,1000,59034 & D, 4545,3499 to a udf where u will filter on condition and result of the udf mapped to target....or try to use IF condition in graphical mapping with using substring to compare the first value from both the source fields