How to cause the value in a single control to be stored in multiple records? - InfoPath Dev
in

InfoPath Dev

How to cause the value in a single control to be stored in multiple records?

Last post 03-25-2011 11:32 AM by Javiator. 9 replies.
Page 1 of 1 (10 items)
Sort Posts: Previous Next
  • 03-10-2011 10:36 AM

    How to cause the value in a single control to be stored in multiple records?

    Hello,

    First, I am very new to InfoPath.  I am trying to design a form that contains several pieces of information for each person in a training session.  My form is connected to an Access 2007 database.  There are two fields in the table which will contain the same values for each record (person) in a common training class, and the rest of the fields contain information that is unique to each record (person).  I would like to save the user some time by having a single control (dropdown list box) on the form for each of the two "common" fields, so that they would only have to enter the values once, and this value would be stored in every record.  Is there a way to accomplish this?

     Thank you so much!

    Filed under: ,
  • 03-10-2011 12:27 PM In reply to

    Re: How to cause the value in a single control to be stored in multiple records?

    Add your drop down bound to the first field. Have a rule on the field to set the value of the second field to the first field's value.

    Alternatively, set the default value of the second field to the first field....

    Hilary Stoupa

  • 03-10-2011 01:34 PM In reply to

    Re: How to cause the value in a single control to be stored in multiple records?

    Hello,

    Thank you for your response.  I don't think I have articulated my problem very clearly, so I will try to do better this time.

    My form is laid out in a repeating table.  Right now, there are two fields where the user will have to keep entering the same items repeatedly.  That is to say, he or she will have to enter one thing in Field A over and over, and something different in Field B over and over.  The value in Field A will be the same for each record, and the value in Field B will also be the same for each record (though not the same as the value in Field A).  The remaining 13 fields that will all have unique values.

    I don't even know if this is possible, but here is what I wish I could do:  I would like to have two dropdown list boxes at the top of my form, one for Field A and another for Field B.  I would like whatever value is entered in Dropdown A to populate in Field A for every record, and whatever value is entered in Dropdown B to do likewise in Field B for every record.  This way, the user could make one selection for each field, and be done with it.  Each time the user inserts a row in the repeating table, I would like Field A and Field B to populate automatically.  Can this be done?

    Thank you!

  • 03-10-2011 02:19 PM In reply to

    Re: How to cause the value in a single control to be stored in multiple records?

    Yep, either with a rule on the repeating table or with a default value on the field. I'm attaching a sample form. Right click the link in the post header and save the form locally. Then right click the saved form and select Design to open in design mode. From there you can preview.

    I've taken two different approaches here -- FieldA has a default value, FieldB gets populated on a rule on the repeating group itself. The sample just uses text boxes, but the same idea will work regardless of the control.

    Worth noting -- the default value updates when the source field changes, so FieldA will change if the first FieldA changes. FieldB is set with a rule, so gets set when the row is inserted and doesn't change after that.

    Oh, and the sample is in IP 2007. Let me know if you are using IP 2003 and I can save as that format and re-post.

    Hilary Stoupa

  • 03-15-2011 07:52 AM In reply to

    Re: How to cause the value in a single control to be stored in multiple records?

    Hello,

    Sorry for the delayed response; I got pinned down by other assignments.  Thanks so much for the sample, and the explanation.  I think I would like to go with the "FieldA" strategy, but I'm having a good deal of difficulty with syntax.  My actual object names are as follows:

    Group: tblOnlineTAP
    Field A: SessionID
    Field B: ProfileID

    When I use the formula builder to create the default value by imitating the syntax in your example, the result is:

    ..[1]/.   ...which I believe is the equivalent of:   @tblOnlineTAP[1]/@SessionID

    I get the following error:

     

    Expected value type: end-of-string

    Actual value: [
    ..-->[<--1]/.

     

    How do I resolve this?

     Thank you!

  • 03-15-2011 08:05 AM In reply to

    Re: How to cause the value in a single control to be stored in multiple records?

    One more thing.  When I manually key @tblOnlineTAP[1]/@SessionID into the builder, the formula is accepted, but my dropdown selection in the first row is apparently not repeated.  I don't know if this would have any effect, but my control is populated by a query.  The control is set to display a query field which concatenates the values from several fields, in order to make it easy for the user to select the appropriate item.  The actual value is a foreign key from a different table in my database.  Could what we are doing here cause the value to be entered without showing the display information on the control?

    Thanks!

  • 03-15-2011 08:17 AM In reply to

    Re: How to cause the value in a single control to be stored in multiple records?

    I tested for the last question on my previous post, and found that the value is not being entered.

  • 03-15-2011 08:46 AM In reply to

    Re: How to cause the value in a single control to be stored in multiple records?

    You need to select the "Edit Xpath" checkbox in the formula editor to add the [1]. You can attach your template to a reply (under the options tab) and I can help you with your syntax in your form.

    Hilary Stoupa

  • 03-15-2011 11:11 AM In reply to

    Re: How to cause the value in a single control to be stored in multiple records?

    Hello,

    I clicked "Edit Xpath" and keyed in the syntax, but nothing has changed.  When I click "Insert Item," the field is still blank in the added row.

  • 03-25-2011 11:32 AM In reply to

    Re: How to cause the value in a single control to be stored in multiple records?

    Hello,

    My error was in failing to enter the full XPath in the builder, while attempting to follow Hilary's examples.  Here is the correct procedure:

    1. Go to the Data Source task pane
    2. Right-click on the appropriate node (for this example, the SessionID field)
    3. Select "Copy XPath."
    4. In the Tools menu, select Default Values...
    5. Expand as necessary, and right-click on the field to which you want to apply the default value (again, SessionID).
    6. Click the Fx button, to open the builder.
    7. Check the Edit XPath (advanced) checkbox.
    8. Paste the XPath copied in step 3.  (In this case:  /dfs:myFields/dfs:dataFields/d:tblOnlineTAP/@SessionID)
    9. Insert the [1] index, as follows: /dfs:myFields/dfs:dataFields/d:tblOnlineTAP[1]/@SessionID
    10. OK out of all dialogs.

    Many thanks to Hilary Stoupa!

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