Home Page › Forums › BizTalk 2004 – BizTalk 2010 › Looping issue
- This topic has 4 replies, 1 voice, and was last updated 8 years, 4 months ago by
community-content.
-
AuthorPosts
-
-
January 31, 2007 at 4:29 PM #17503
Hi
I have a my schema creates xml something like the following.
– <DetailCaseGroup>
– <CarrierPINInfo>
<RecordType>P01</RecordType>
<PartnerID>0819405510</PartnerID>
<WayBillNo>1014900</WayBillNo>
<DateReceived>20061229</DateReceived>
<TimeReceived>12:23:00</TimeReceived>
<CarrierPINNo>1179364</CarrierPINNo>
<Filler />
</CarrierPINInfo>
– <CarrierPINInfo>
<RecordType>P01</RecordType>
<PartnerID>0819405510</PartnerID>
<WayBillNo>1014900</WayBillNo>
<DateReceived>20061229</DateReceived>
<TimeReceived>12:23:00</TimeReceived>
<CarrierPINNo>1179365</CarrierPINNo>
<Filler />
</CarrierPINInfo>
– <ItemLevel>
<RecordType>I01</RecordType>
<PartnerID>0819405510</PartnerID>
<WayBillNo>1014900</WayBillNo>
<DateReceived>20061229</DateReceived>
<TimeReceived>12:23:00</TimeReceived>
<PONo>18745</PONo>
<POLineNo>001</POLineNo>
<ShippedQuantity>0000000001</ShippedQuantity>
<VendorPartNo>760775</VendorPartNo>
<NexiPartNo>602213</NexiPartNo>
<MFGPartNo>FAC3</MFGPartNo>
<ItemDescription>KEYBOARD-</ItemDescription>
<Filler />
</ItemLevel>
– </DetailCaseGroup>
I need to store these value in to one table. I need to store the lastest CarrierPINNo for each Item. In this case I want to store 1179365 for both item. How can I do that?
I have a following script functoid in the map to get the latest CarrierPINNo. Input of the funtoid is CarrierPINNo node and out put is column name in the table.
Dim sCarrierPINNo As String = ""
Public Function getCarrierPINNo(ByVal carrierPINNo As String) As String
If Not carrierPINNo.Length = 0 Then
sCarrierPINNo = carrierPINNo
End If
Return sCarrierPINNo
End FunctionBut It is storing the first CarrierPINNo in to table. Which is 1179364. That is wrong. Could any one help me to fix this issue.
What I am doing wrong here?
Siva
-
February 1, 2007 at 5:41 AM #17509
Hi Siva –
What you can do to get the lastest CarrierPINNNo is to have a count functoid (purple, advanced) count the number of CarrierPINNo loop iterations in a DetailCaseGroup and then use index functoid (purple, advanced) to sent that iteration indexed by the count to the scriptoid.
What you are doing now is sending them all and it is picking the first one, because there is nothing to specify that you want the last iteration in the loop. So you're going to get that interation # with count and then use it as input to the index functiod to pull the right value.
– weak architect
-
February 1, 2007 at 10:35 AM #17515
If you were using Xslt then //CarrierPINInfo[position()=last()]/CarrierPINNo would work.
With functoids, use the Index functoid and RecordCount functoid
CarrierPINInfo – RecordCount-|
CarrierPINNo ———————–|— Index — Result-
February 1, 2007 at 10:50 AM #17517
Hi,
I am getting empty string when i use above funtoids. if i change the parameters order in the index, then not value for carrierPINNo
I posted a message wtih more detail, but it is waitting for the aprovel from this webside guys.
is there any way I can handle this?
I thought my script will update the CarrierPINNo whenever there is a value appers in the xml file. but it is passing the first value. So what I am thinking whenever it get first value, it just give it to destination node.
-
February 3, 2007 at 6:07 PM #17550
Oops, first reply wouldn't work.
I have tested this one:
CarrierPINInfo —RecordCount —\
\—Interation———-\—–Equal —-\
\
CarrierPINNo—————————————————-\——–ValueMapping(Flattening) ——ouput
-
-
-
-
AuthorPosts
- The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.