Skip to Content
avatar image
Former Member

How to pass value from multiple source values to multiple target values

Hi Users,

In my mapping one condition is like that "Select student record where type= "Count" then map value to target field("First"). if count is not found then map "0".

My source structure follows like

<Record>

<Recordset>

<Student>

<type>ABC</type>

<value>123</value>

</Student>

<Student>

<type>Count</type>

<value>456</value>

</Student>

</Record>

</Recordset>

<Record>

<Recordset>

<Student>

<type>TEF</type>

<value>123</value>

</Student>

<Student>

<type>DEF</type>

<value>123</value>

</Student>

</Record>

</Recordset>

Target node is "ITEM" is generated based on Record. The target output structures shows below

<ITEM>

<First>456</First>

</ITEM>

<ITEM>

<First>0</First>

</ITEM>

Please help out to me

.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Aug 08, 2011 at 05:19 AM

    Hi,

    As you said your target structure shows

    <ITEM>

    <First>456</First>

    </ITEM>

    <ITEM>

    <First>0</First>

    </ITEM>

    then what is the problem in this..? what is expected target structure?

    could you explain your problem by providing expected target structure and target structure which your are getting now..

    Thanks,

    Bhupesh

    Add comment
    10|10000 characters needed characters exceeded

    • Use the boolean function "If".

      Your mapping would be :

      Type

      -


      > EqualS --> If -


      >First. For the If, true pass Value, false pass 0.

      Constant (Count) .

      Keep the context at the immediate parent level for all input fields, i.e, do not change the contexts of the inputs. It will be as is.

      Regards

  • Aug 08, 2011 at 05:51 AM

    Hi Swathi,

    1. Map the source Record to target ITEM node.

    2. Pass values to the boolean "If" function to validate the condition that <type> is equal to "Count", if true then pass the <value> to the target and if not else part you map the Consant value as "0". Contexts have to be taken care while using this so that it will generate as requested.

    Regards,

    JP.

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 08, 2011 at 07:55 AM

    Hello,

    You need to play around with contexts and sorting. You can try using the mapping below:

    For ITEM

                     value(set context to recordset) -> 
    type(set context to recordset) -> equalsS -> ifThenElse -> sort: lexicographical case insensitive descending -> collapseContext -> ITEM
                   Constant: Count -> /  Constant: 0 -> /
    
    

    For First

                     value(set context to recordset) -> 
    type(set context to recordset) -> equalsS -> ifThenElse -> sort: lexicographical case insensitive descending -> collapseContext -> splitByValue:eachValue -> First
                   Constant: Count -> /  Constant: 0 -> /
    
    

    Hope this helps,

    Mark

    Edited by: Mark Dihiansan on Aug 8, 2011 9:56 AM

    Add comment
    10|10000 characters needed characters exceeded