How to switch to data entry view and populate based on a parameter? - InfoPath Dev
in

InfoPath Dev

How to switch to data entry view and populate based on a parameter?

Last post 06-10-2009 02:08 PM by kminor. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 06-07-2009 09:08 PM

    How to switch to data entry view and populate based on a parameter?

    Hello, I could use some help, please.

    I have a view that displays records from a secondary data source in a repeating table.  I added a button that is displayed on each row of the repeating table and set them to run custom code.  I've hobbled together some code to get the unique identifier of that row's record (ex:  56).

    When the user presses one of the buttons, I would like to switch to my data entry view and have that row's record already pulled up from the main data connection (both include this particular ID field).  How can I do this in code (VB Script)?  It seems like there must be a way to tell the data entry view to open and pull up the data for ID# 56.

    Thanks for any and all help!

    ETA -- I'm using InfoPath 2003...

    -- Kelley
  • 06-10-2009 07:01 AM In reply to

    Re: How to switch to data entry view and populate based on a parameter?

    Does anyone know how to do this, if it can even be done?  Thanks in advance for any help!

    -- Kelley
  • 06-10-2009 02:08 PM In reply to

    Re: How to switch to data entry view and populate based on a parameter?

    After much swearing, I found a way to do this.  I'm sure it's not the most efficient way to do it, but it works.

    I have a view that displays detail records for submitted requests in a repeating table, and each row/record has a small button in the left-most column.  I added a query field for my Request ID (the primary key for each of my forms) beneath the table and set its width = 0 px (don't need to/want to see it).  The Request ID is also displayed in my repeating table.

    In the onClick for each row's button, I set the value of the Request ID query field = the Request ID for that row:

    XDocument.DOM.selectSingleNode("//dfs:queryFields/q:Requests/@RequestID").text = _ eventObj.Source.selectSingleNode("@RequestID").text

    Still in the onClick, I switch views to my data entry screen:

    XDocument.View.SwitchView("Submit Request")

    ---------------------------------------------

    Now, on that hidden query textbox, I added a rule that says if it's not blank, submit to my main data connection.

    That more or less accomplished what I was trying to accomplish -- the end result is that I'm taken to my data entry view, and it's pre-populated with the information from the request.

    I still have a problem, though -- the data from the other table in my main data connection still isn't coming in.  Argh!  Hilary had suggested some things on an old thread of mine.  Off to review her suggestions again...

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