views:

120

answers:

2

Hi

I have a schema that contains the details for an order. Within the schema, I have a collection of line items containing details of each item within the order. Schema is similar to the following structure.

Order
    SaleItems
        SaleItem
            OrderID
            Price
            Quantity 
            etc.

I have a requirement that if the Quantity within SaleItem is more than 1, that another line item should be created and the price be divided between the line items, so for example:

Order
    SaleItems
        SaleItem
            OrderID  1234
            Price    99
            Quantity 3

Should result in the following being created in the output:

Order
    SaleItems
        SaleItem
            OrderID  1234
            Price    33
            Quantity 1 
        SaleItem
            OrderID  1234
            Price    33
            Quantity 1  
        SaleItem
            OrderID  1234
            Price    33
            Quantity 1

Could any of you Biztalk guru's advise one the best way to accomplish this? I don't know if it would be best to do it in a map with some of the functiods and if so what to put in the map, or in an orchestration with some custom to do the IF Quantity > 1 logic. Maybe I'm missing something very simple here, but any help would be gratefully recieved.

Richard

+2  A: 

You can write that transformation as a custom XSLT and then get Biztalk to use that to do the transformation.

Shiraz Bhaiji
A: 

You didn't mention the scenario where this map will be utilized, if in case you need this conversion inside an orchestration, then the easiest and quickest solution will be to utilize the .NET helper classes with serialized messages. In that way you can do, what you have mentioned if qty > 1...type of logic. I'm sure you'll be able to achive this in the map as well, will require some fidling with BizTalk mapper or some custom XSLT development. You may need to choose the later route if you are planning to utilize the map in your ports.

HTH

Saravana Kumar

related questions