It is very common scenario to map values from a loop in the applications where EDI X12 schemas are used and one of them is N1 Loop. Loops are nothing but blocks of repeating data. And N1 loop is such block which has address related data (Party Identification). It is not mandatory and in the schema which ships with BizTalk, allows it to repeat up-to 200 times (EDI schema are shipped in as a self-extracting executable and when extracted, schemas can be found at drive:\Program Files\Microsoft BizTalk Server 2010\XSD_Schema\EDI. See more) But it can vary and totally depends upon the requirement. See more. And from the multiple data, specific data is to be mapped to a particular node. In this article, BillTo and ShipTo nodes are used as an example to which data is to be mapped from repeating data (N1Loop).
ST*850*0001~
BEG*00*DS*45000007**20131002~
CUR*BY*USD~
REF*KK*STANDARD~
REF*BAI*8000~
REF*AAT*80206234~
REF*BLT*INVOICE~
REF*VR*1~
PER*BD*Collin Wag*TE*610-386-1189*FX*610-728-2210*EM*collin_wag@someemail.com~
N9*ZZ**REFERENCE NOTES~
N1*BT*Demo International*91*1100~
N2*WAN MIN-SV~
N3*PO Box 158~
N4*Secaus*NJ*07096*US~
PER*PR**TE*1110001111***EM*mahesht@ivisionsoftware.com~
N1*ST*BMS MEDEREX*91*00000~
N3*700 RD~
N4*RED CITY*CA*940632477*US~
PER*SH**TE*1110001111***EM*maheshstiwari@gmail.com~
N1*VN*Demo BIOSCIENCES*91*6868~
REF*PO*0043331289~
PO1*00001*2*PK*175.95*DI*VC*28-9165-37*CB*95056-246***PL*000040~
PID*F**ZZ*C*HITRAP CAPTO DEAE 1ML PK5 HITRAP CAPTO D~
PO4*1*1*PK~
REF*AAS*8013170709~
REF*BV*00004~
REF*PRT*2~
REF*LT*N~
DTM*002*20130828~
CTT*1~
SE*33*0001~
<
xsl:for-each
select
=
"s0:N1Loop1"
>
"s0:N2"
xsl:variable
name
"var:v2"
"userCSharp:LogicalEq(string(../s0:N1/N101/text()) , "
ST
""
")" />
xsl:if
test
"$var:v2"
ShipTo
"../s0:N1/N104"
ID
xsl:value-of
"../s0:N1/N104/text()"
/>
</
"../s0:N1/N102"
Name
"../s0:N1/N102/text()"
AddressLine1
"N201/text()"
AddressLine2
"../s0:N3/N301/text()"
"../s0:N4/N401"
City
"../s0:N4/N401/text()"
"../s0:N4/N402"
State
"../s0:N4/N402/text()"
"../s0:N4/N403"
PostalCode
"../s0:N4/N403/text()"
"../s0:N4/N404"
Country
"../s0:N4/N404/text()"
"../s0:PER_2/PER04"
TelephoneNumber
"../s0:PER_2/PER04/text()"
"../s0:PER_2/PER08"
EmailAddress
"../s0:PER_2/PER08/text()"
".."
"../text()"
"var:v3"
"string(../s0:N1/N101/text())"
"var:v4"
"userCSharp:LogicalEq($var:v3 , "
BT
"$var:v4"
BillTo
"../s0:N1/N103"
"../s0:N1/N103/text()"
Header
OrderId
>45000007</
OrderDate
>2013-10-02</
Currency
>USD</
>00000</
>BMS MEDEREX</
>WAN MIN-SV</
>700 RD</
>RED CITY</
>CA</
>940632477</
>US</
>1110001111</
>maheshstiwari@gmail.com</
>91</
>Demo International</
>PO Box 158</
>Secaus</
>NJ</
>07096</
>mahesht@ivisionsoftware.com</
HeaderComment
>This is Header Comment</
Details
Item
ItemId
>28-9165-37</
ItemDescription
>C</
Quantity
>2</
UnitPrice
>175.95</
LineNumber
>00001</
UOM
>PK</
RequestedDeliveryDate
LineComment
>This is line comment</
Another important place to find a huge amount of BizTalk related articles is the TechNet Wiki itself. The best entry point is BizTalk Server Resources on the TechNet Wiki.