Implementing First, Previous, Next and Last functi - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Implementing First, Previous, Next and Last functi

Last post 06-21-2005 04:15 PM by Greg Collins. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 06-15-2005 01:56 PM

    • kfrost
    • Not Ranked
    • Joined on 06-15-2005
    • Posts 4

    Implementing First, Previous, Next and Last functi

    I've got a form with several forms. 2 in particular that I'm trying to work with right now.

    The main view has a repeating table which is bound to a secondary data connection. It connects to a database and brings in a table called Trips.

    I have a button column on the left of the table so if a user wants to see more details about the trip, they click it which brings up more details about the trip in a view called Trip Details.

    I do this by creating a Rule called TripDetails and add 3 actions
    1) Set a fields value. I take the Main data connections Query/datafield/TripID as the field and then for the value you use the TripID from the secondary source that populates the table
    2) Query Using a data Connection, here I use the Primary SQL connection
    3) Swithc to View: Trip Details

    All of this works great. But I'd like to add |< << >> >| functionality to be able to move through the records while in the Trip Detail view.

    To do this I assume I'm going to have to use the sibling features but I don't know how to programmatically. if anybody has a sample I would appreciate it.

    Additionally, it appears that I should be able to do this using a rule. The best I can tell if I could figure out the appropriate XPATH syntax I could just create the buttons and add rules and the appropriate actions to move through the records.

    I'm trying to set a Set Field value and I'm setting the Field to Query/datafield/TripID and now I'm trying to set the value. Here's what it defaults to:
    xdXDocument:GetDOM("TripDetails")/dfs:myFields/dfs:dataFields/d:Trips/@TripID

    What I'm thinking is I need to figure out how use the preceeding::sibling, Next, Last() etc to get the preceeding or next values. Anybody know how I can modify the xpath statement above to get the TripID value in the previous or next record?

    Thanks.

    kris

  • 06-20-2005 09:21 AM In reply to

    Re: Implementing First, Previous, Next and Last functi

    Hi kfrost,
    Navigating using |<< < > >>| buttons is possible with the code. It is also possible with the conditional formatting/Rules but your InfoPath solution will become slow if you perform many operations in the UI.

    So it is better for you to use code. If you use code you need to maintain two data connections one to store and other to for UI display purposes.

    Hope this helps!

    Agni
    InfoPathDev India
  • 06-21-2005 04:15 PM In reply to

    Re: Implementing First, Previous, Next and Last functi

    For the first page, you would have your button in the repeating table and do the following:

    Create a simple .xml file such as the following:
    <?xml version="1.0" encoding="UTF-8"?>
    <FormData>
    <SelectedRow></SelectedRow>
    </FormData>
    and save it as FormData.xml

    Then, in the InfoPath designer:

    1. Select Data Connections from the Tools menu, and then click Add.
    2. Add the FormData.xml file as a Receive connection.
    In your button's rules, set the value of SelectedRow field using an XPath similar to the following:
    SelectedRow = count(preceding-sibling::my:RepeatingGroup)+1
    In your other view, filter the repeating section based on:
    position() = SelectedRow
    Then setup your other navigation buttons to increment/decrement SelectedRow.

    Greg Collins [InfoPath MVP]
    InfoPath Dev
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.