locked
Mapping issue, if node has value -> Looping Functiod RRS feed

  • Question

  • Hello!

    I have a map with a source schema which contains one or many records of Orders with a few fields. What I am trying to do is map the data from the Orders record in the source schema to the OrderTarget record in a destination schema. So, if I have 3 orders it should be created 3 OrderTarget records. Not so difficult, I just use the Looping Functiod and map the values...

    But the thing I am having problems with is that I just want a new OrderTarget record to be added if a specific field in the Orders record has a value. Otherwise, if the field doesnt have a value no record should be created and it should just go to the next.

    If the source looks like this:

    Code Snippet

    <Orders>
    <Order>
    <orderno>100</orderno>
    </Order>
    <Order>
    <orderno></orderno>
    </Order>
    <Order>
    <orderno>300</orderno>
    </Order>
    </Orders>



    The result should be:

    Code Snippet

    <OrderResults>
    <OrderTarget>
    <orderno>100</orderno>
    </OrderTarget>
    <OrderTarget>
    <orderno>300</orderno>
    </OrderTarget>
    </OrderResults>



    I have tried using the string functiods (size) and "Greater than" and a Value Mapper-functiod on the field. The Value Mapper functiod is then connected to the Looping Functiod. What I was hoping for was that if the field didnt have a value the Value mapper would send anything to the Looping Functiod, but if it had a value the Looping Functiod would create a new OrderTarget record. But what happens is that I always get 2 (!) OrderTarget records..

    Anyone have a solution to my problem?

    regards
    Andreas
    Friday, September 14, 2007 2:23 PM

Answers