How to get and set the value of a field in a repeating section - InfoPath Dev
in

InfoPath Dev

How to get and set the value of a field in a repeating section

Last post 09-12-2012 04:14 PM by Hilary Stoupa. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 09-12-2012 02:59 PM

    How to get and set the value of a field in a repeating section

     Hi,

    I have a repeating section . There will be two instances for contact and address . I want to set the value dynamically through code based on  a drop down selection.I don't know how to get each instance .The form is basedo an XML Schema.

    Here is what the actual XML Should look like :

                        <Contact label="Attn:" linenumber="1">John Smith</Contact>
                        <Contact label="Room:" linenumber="2">640</Contact>

                        <AddressLine linenumber="1">1968 Northeast</AddressLine>
                        <AddressLine linenumber="2">5th Avenue</AddressLine>

    here is the part of the code, 

    but  as you can see it won't work, Please help.

     

                       Dim root As XPathNavigator = MainDataSource.CreateNavigator()

                        root.SelectSingleNode("/PurchaseRequisitionMessage/PurchaseRequisition/RequisitionHeader/ShipTo/Address/Contact/@label", NamespaceManager).SetValue("Attn:")
                        root.SelectSingleNode("/PurchaseRequisitionMessage/PurchaseRequisition/RequisitionHeader/ShipTo/Address/Contact/@linenumber", NamespaceManager).SetValue("1")
                        root.SelectSingleNode("/PurchaseRequisitionMessage/PurchaseRequisition/RequisitionHeader/ShipTo/Address/Contact", NamespaceManager).SetValue("Kim Linnet")
                        root.SelectSingleNode("/PurchaseRequisitionMessage/PurchaseRequisition/RequisitionHeader/ShipTo/Address/Contact/@label", NamespaceManager).SetValue("Room:")
                        root.SelectSingleNode("/PurchaseRequisitionMessage/PurchaseRequisition/RequisitionHeader/ShipTo/Address/Contact/@linenumber", NamespaceManager).SetValue("2")
                        root.SelectSingleNode("/PurchaseRequisitionMessage/PurchaseRequisition/RequisitionHeader/ShipTo/Address/Contact", NamespaceManager).SetValue("640")

     

     Thanks

     

  • 09-12-2012 04:14 PM In reply to

    Re: How to get and set the value of a field in a repeating section

    Hi - for your code, look into XPathNodeIterator. You can also do this with qRules, if you'd rather not write code, or this blog post may help you do this without code.

    Hilary Stoupa

Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.