cancel
Showing results for 
Search instead for 
Did you mean: 

CopyValue function

Former Member
0 Kudos

Hi Experts,

I have thee source structure as.... Adress field as occurance of Min=3 & Max=3

<?xml version="1.0" encoding="UTF-8"?>

<ns0:CopyValue_Source_MT xmlns:ns0="http://mapping.com">

<Partner>

<PartnerName>Name1</PartnerName>

<Address>Manyata</Address>

<Address>Bangalore</Address>

<Address>560045</Address>

</Partner>

<Partner>

<PartnerName>Name2</PartnerName>

<Address>White field</Address>

<Address>Bengalooru</Address>

<Address>560010</Address>

</Partner>

</ns0:CopyValue_Source_MT>

I need to replicate to traget structure as it is in source...if i use copy value it replicates first context values in both context of target...

<?xml version="1.0" encoding="UTF-8" ?>

- <ns0:CopyValue_Target_MT xmlns:ns0="http://mapping.com">

- <CustomerRecords>

<Name>Name1</Name>

<Street>Manyata</Street>

<City>Bangalore</City>

<Pincode>560045</Pincode>

</CustomerRecords>

- <CustomerRecords>

<Name>Name2</Name>

<Street>Manyata</Street>

<City>Bangalore</City>

<Pincode>560045</Pincode>

</CustomerRecords>

</ns0:CopyValue_Target_MT>

Regards

nandan

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Nandan,

You need to map like this:

Partner ---> CustomerRecords

PartnerName ---> Name

Address ---> Street

For city use simple if then with out else and map like this:

Address > Index (1,1,context)-> equals text function to constant 2 --> if

then--> Address --> city

For Pincode use simple if then with out else and map like this:

Address > Index (1,1,context)-> equals text function to constant 3 --> if

then--> Address --> Pincode

It should work. I tested in my system.

Regards,

---Satish

Former Member
0 Kudos

Instead of copyValue function create UDFs as given below

getStreet UDF

define a argument and name it street and choose CONTEXT while creating this UDF


 result.addValue(street[0]);

use mapping as given below


address-----> getStreet(UDF)------.street(targetfield)

getCity UDF

define a argument and name it city and choose CONTEXT while creating this UDF


 result.addValue(city[1]);

use mapping as given below


address-----> getCity(UDF)------.>city(targetfield)

getPincode UDF

define a argument and name it pincode and choose CONTEXT while creating this UDF


 result.addValue(pincode[2]);

use mapping as given below


address-----> getPincode(UDF)------.pincode(targetfield)

I have tested the above UDF .It is working fine .

Former Member
0 Kudos
if i use copy value it replicates first context values in both context of target...

I suggest you to check this out to understand CopyValue better

/people/sravya.talanki2/blog/2005/12/08/message-mapping-simplified-150-part-ii

Regards,

Manjusha.

Former Member
0 Kudos

Hi,

I understand that CopyValue function ...as it replicates only first value of the context..

To find the solution for above explained requirement , which function should i use..

please suggest on this ...

regards

nandan

Former Member
0 Kudos

Did you checked this thread which talks the same

Rajesh

Former Member
0 Kudos

hi rajesh,

I've Checked the thread whick talks about the same .. but the exact solution not found...

regards

Nandan

Former Member
0 Kudos

Did you tried the solution provided there

i.e

address - index

equals -


> if withoutelse

-


> target

constant (1)

address then

The above solutin will work for your source and target message types,I have cross checked the same

Rajesh

Former Member
0 Kudos
markangelo_dihiansan
Active Contributor
0 Kudos

Hi,

Please use this mapping:

For CustomerRecords:

<Partner> --> removeContext --> <CustomerRecords>

For Name:

<PartnerName> --> <Name> (this is assuming that PartnerName has a context change per name) otherwise insert splitByValue

For Street, City, Pincode:

<Address> --> <Street>

<Address> --> <City>

<Address> --> <Pincode> (this is assuming that the source nodes have a context change per line) otherwise insert splitByValue

If you use copyValue, it will populate the ALL instances specified in the location.

Hope this helps,