Getting nth element from secondary data source - InfoPath Dev
in

InfoPath Dev

Getting nth element from secondary data source

Last post 11-12-2008 07:38 AM by guptasourav. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 11-11-2008 02:01 PM

    Getting nth element from secondary data source

     Hi,

    I have a secondary data source returning some unique IDs. I want to get nth value from this datasource and show it in a text box.

    Is this possible without writing code. Is there a way to get this by using Xpath.

    Thanks
    Sourav
  • 11-11-2008 09:20 PM In reply to

    • Shiva
    • Top 25 Contributor
    • Joined on 04-15-2005
    • India
    • Posts 694

    Re: Getting nth element from secondary data source

    Hello,

    We can get the nth position of element from repeating node using XPath. As below,

    xdXDocument:GetDOM(“Secondary DOM Name")/my:RootNode/my:NodeName/my:RepeatingNodeName[<position of the node>]

  • 11-11-2008 09:27 PM In reply to

    Re: Getting nth element from secondary data source

    Hi,

    Use the following Xpath to get nth value.

    xdXDocument:GetDOM("SecondaryDataSource")/Vehicles/Year[n]/@value

    In this example Year is repeating group and value is the attribute.

  • 11-12-2008 01:49 AM In reply to

    Re: Getting nth element from secondary data source

    Hi,If the form is a browser form, [n] does not work. Use the following xpath as default value for a text box to get the nth element in a browser form.xdXDocument:GetDOM(“Secondary DOM Name")/RootNode/NodeName/RepeatingNodeName[count(preceding-sibling::RepeatingNodeName) = (n-1)]/fieldNodeExample: xdXDocument:GetDOM("Emp")/Employees/Emp[count(preceding-sibling::Emp) = (n-1)]/EmpID 

     

    Swathip
    www.ggktech.com
  • 11-12-2008 07:38 AM In reply to

    Re: Getting nth element from secondary data source

     Thanks a lot for your reply.  It solved my prob.

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