cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping for Mendatory fields (1..1) when source is not sending the req info

Former Member
0 Kudos

Hi All:

I have two xsd one for source and one for target.

<b>source :</b>

Fname

Lname

Mname

Address (occurance 0..unbound)

-Street (1..1)

-City (1..1)

-PIN (1..1)

-Country (1..1)

<b>Target</b>

Name (1..1)

Address (1..1)

-Street (1..1)

-City (1..1)

-PIN (1..1)

-Country (1..1)

If Address array is coming in source xml that there in no problem in Mapping. But if source xml does not have address array then mapping will fail as the cardinality for the target is 1..1

Bottom line if souce xml does not have Address array, even address array has to be generated in target.

How can I achive it in Message Mapping?? Any how I have to generate one address array in the target even address array is not present in the source xml

<b>Thanks</b>

Farooq.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Farooq

You can use the standard Node function "exists" to check for the existence of the node and handle it accordingly using "If" standard Boolean function

regard

skrishna

Answers (4)

Answers (4)

former_member214364
Active Contributor
0 Kudos

Hi

As Bhavesh said,you need to use <b>mapWithDefault</b> function in mapping target node(Address) and elements(Street,City,PIN and Country)

Former Member
0 Kudos

Hi All:

I achived this using If-else function.

like :

address--exist--address

else blank to --address.

It will generatre address element.(but not subelement)

then for every sub element of address

addressexist-map source street to target street

else map constant(blank) to target street.

it will generate street..same is applicable for other..like city, PIN etc

Thanks all for your response

Former Member
0 Kudos

Hi Farooq,

Use MAPWITHDEFAULT . It is same as using IFELSE function & EXISTS together.

Better to use mapwithdefault.

Regards,

SUmit

Former Member
0 Kudos

Hi All:

I have to generate the Address array, and I cannot change the occurance from1..1 to 0..1

Also I already tried if-else funciton like :

Address -exist then map address else map constant(empty). But I got

only Address tag in output not the whole array.

out out is like this

Name

Address (no subelements).

bottom line I cannot change the xsd. but has to generate the Address array(with all sub field) on the target

Thanks

Regards.

Former Member
0 Kudos

Hi Farooq,

If you want to generate sub elements you need to use the mapwithdefault

function in between all the elements which are part of Address structure.

Address (1..1)

-Street (1..1)

-City (1..1)

-PIN (1..1)

-Country (1..

Regards,

Sumit

bhavesh_kantilal
Active Contributor
0 Kudos

Like pointed by Satish change occurrence to 0 to unbounded of the address field and then use MAPWITHDEFAULT.

Regards

Bhavesh

Former Member
0 Kudos

Mazhar,

Just change their occurence from 1.1 to 0.1. If you are writing a CSV file then if you change this then it should be fine.

If you are using fixed length file then in the mapping use an If-ELSE condition. If you have the field exists then pass the field else pass constant which is equal to the length of the field.

---Satish