Home Page › Forums › BizTalk 2004 – BizTalk 2010 › XPath Assigment
- This topic has 1 reply, 1 voice, and was last updated 9 years, 10 months ago by
community-content.
-
AuthorPosts
-
-
December 8, 2009 at 2:23 AM #23857
Hi,
I am using Biztalk 2006 R2 and have a problem.
I want to populate a xml message with value that I get from the incoming file name. All values of the Element <Company> shall have this value I get from the filename. Company is of type String and I set the value to “TST” through the mapping. Node LedgerJournalTransTable and LedgerJournalTrans are MinOccurs=0 MaxOccurs=unbounded.
The XML is something like this:
<ns0:GL xmlns:ns0=”NameSpace”>
<ns0:SenderId>TST</ns0:SenderId>
<ns0:LedgerJournalTransTable>
<ns0:JournalName>Lonn</ns0:JournalName>
<ns0:LedgerJournalTrans>
<ns0:AccountNum>1720</ns0:AccountNum>
<ns0:AmountCurCredit>2825.00</ns0:AmountCurCredit>
<ns0:Company>TST</ns0:Company>
</ns0:LedgerJournalTrans>
<ns0:LedgerJournalTrans>
<ns0:AccountNum>1720</ns0:AccountNum>
<ns0:AmountCurCredit>2825.00</ns0:AmountCurCredit>
<ns0:Company>TST</ns0:Company>
</ns0:LedgerJournalTrans>
<ns0:LedgerJournalTrans>
<ns0:AccountNum>1720</ns0:AccountNum>
<ns0:AmountCurCredit>2825.00</ns0:AmountCurCredit>
<ns0:Company>TST</ns0:Company>
</ns0:LedgerJournalTrans>
</ns0:LedgerJournalTrans>
</ns0:GL>I tried to use xpath to assign a value to the Company in a assignment expression shape. Get an error when I try this.
Is it possible to use xpath to assign values to several elements like this?
What would be the recommended approach for this problem.?
Thanks, Dag
-
December 8, 2009 at 7:04 PM #23865
The xpath function can only update a single node, it will not update a collection of nodes.
Solutions
1. Use a loop in your orchestration and use an indexed xpath e.g. /GL/LedgerJournalTransTable/LedgerJournalTrans/Company[index]
This is ugly and slow.2. Create a property schema and add a Company property (of type MessageContextPropertyBase)
Promote your company value into this property on the map source message.
Create a map and use the ContextAccessor functoid (http://contextaccessor.codeplex.com/) to map this property into the output document.
-
-
AuthorPosts
- The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.