Hi all,

quite new to Biztalk Development I'm facing a problem or design question, I couldn't find any close answer to.

I have to do a mapping between a standard SAP idoc and a custom datamaster schema. The idoc schema contains several segments, recurring several times. Within this segments I would like to map a value (Element1 e.g.) to my datamaster schema depending on another value (Element2) of my idoc.

To make it clearer:

iDoc-SegmentA (may occur 1 ... n)
    - <Element1>A Date</Element1>
    - <Element2>001</Elememt2>

   - DateTime1
   - DateTime2
   - DateTime3

What I would like to achieve is:

In case Element2 in SAP is "001" I would like to map DateTime1 to Element1, in case of "002" I would like to map DateTime2, and so on ...

I solved this by using Looping Functiods and combining with logical funtoids (EQUAL), but since I have plenty of recurring segments and a lot of conditional expressions to evaluate in our business process, the map becomes quite complex and confusing.

Isn't there a better approach to target topics like this? Custom Scripts (Scripting functoids) or anything else?

Any help or direction would really be appreciated.

Thanks a lot in advance,