Skip to Content
author's profile photo Former Member
Former Member

CopyValue function

Hi Experts,

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

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

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" ?>

- 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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Posted on Jul 21, 2009 at 05:44 AM

    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,

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 21, 2009 at 05:47 AM
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 21, 2009 at 05:56 AM
    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.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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

  • author's profile photo Former Member
    Former Member
    Posted on Jul 21, 2009 at 12:39 PM

    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 .

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 21, 2009 at 04:04 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.