in

InfoPath Dev

Auto populate - only adds data from first row in database

Last post 11-06-2008 10:20 PM by Jo-Anne Alfafara. 9 replies.
Page 1 of 1 (10 items)
Sort Posts: Previous Next
  • 07-12-2008 04:45 AM

    Auto populate - only adds data from first row in database

    Hiya,


    I'm currently working on a form where I have customer details (from Access DB set up as secondary data source) set to auto populate related fields.  I've done this using rules set to a list box. 

    My problem is that when I preview or test the form, the auto populate will only enter the data set up to the first row in the Access DB, no matter which option I choose from the list. 

    I've seen this problem elsewhere while scouring the forums but I could not find any resolution, apologies if this has been covered somewhere.

    Any help is much appreciated.  Let me know if you need more detail.

    Thank you!
     

  • 07-12-2008 05:35 AM In reply to

    Re: Auto populate - only adds data from first row in database

    Hello and welcome!

    In your rules where you set the value of the fields you wish to auto-populate, are you filtering your data? Let's say that your list box has customer name and you wish to fill a field with the customer phone. When you set your rule, you would first select Set a field's value then select the field where you want the phone number.

    To filter for the correct phone number, select the formula button next to the Value field. In the formula window, select Insert Field or Group. Select your secondary data source and the phone number field. Select the Filter Data ...  button. Select Add. In the first drop down, select the customer name field from your secondary data source. Leave the middle one set to Is equal to. For the third drop down, select the field on your form that is bound to the control with the customer name in it.

    At this point, what you are basically telling the rule is: Go get me a phone number. I want it to belong to the same customer as the one I just selected in my List Box.

    Let me know if you need more help, okay?

    Hilary Stoupa / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
    Filed under:
  • 07-13-2008 12:12 AM In reply to

    Re: Auto populate - only adds data from first row in database

    Perfect!  Thanks a bunch for the help, I've been messing about with this for a while now!

     

    Thanks again. 

  • 07-23-2008 12:04 PM In reply to

    Re: Auto populate - only adds data from first row in database

    Awesome! I've spent hours trying to figure this out. Thank you!

  • 07-26-2008 05:06 PM In reply to

    • AaronB
    • Not Ranked
    • Joined on 07-25-2008
    • Posts 5

    Re: Auto populate - only adds data from first row in database

    I am having this same issue, but using a SharePoint list as my secondary data source. I followed your instructions, but am still only getting back results for the first item in my list.

  • 07-27-2008 01:28 AM In reply to

    • JamieG
    • Not Ranked
    • Joined on 07-27-2008
    • Posts 2

    Re: Auto populate - only adds data from first row in database

    Hi Hillary,

    Thanks for your post. It has got me half way there but im still having problems. In your scenario, I am trying to display the customer's phone number for reference, not to be submitted as a field in my form, but the number to display is still based on the customer name selected from a drop down box.

     I have the dropdown box populated from a second seondary data source of customer names, ie not the datasource that contains customer names AND customer phone numbers which is used for the lookup. So far it works fine, I load up the form and in my drop down box i have all the customer names. i click on a customer name and that customer's phone number is displayed in a control bound to the customer name/phone number data source. Fine.

     The problem comes when i try afterwards to select a different customer name. The phone number control just goes blank instead of being populated with the phone number of the new selection. I guess what is happening is it is not re-filtering the data source correctly.

     Do you have any suggestions as to how i can fix this?

    Many thanks,

     Jamie

  • 07-27-2008 02:56 AM In reply to

    • JamieG
    • Not Ranked
    • Joined on 07-27-2008
    • Posts 2

    Re: Auto populate - only adds data from first row in database

    I have found the solution on one of Greg Collins' posts http://www.infopathdev.com/forums/p/3218/12339.aspx#12339

     The answer was to set the rule to firstly query the datasource then set the field as described in this post.  

     Thanks Greg and Hillary.

     Jamie

     

  • 09-22-2008 12:22 PM In reply to

    Re: Auto populate - only adds data from first row in database

    I was looking into the same issue and your info worked for me as well.  Thank you!

    Jeff
  • 11-05-2008 10:55 AM In reply to

    Re: Auto populate - only adds data from first row in database

    I am having issues with trying to get this to work. 

    I have two drop downs with two different Secondary data sources.  I want to pick a selection from the first to auto select a choice on the 2nd.

    Drop down 1: Contracts table with a Sales Person ID not on drop down, but in table.

    Drop down 2: Sales People (Name as display, ID as value)

     When I click a contract, I want to take a Salesperson ID from drop down 1 and set it to the value of drop down 2. 

    This scenario will only select the first choice with no filter, when I try to filter, nothing appears on DDL2. 

    Am I having problems due to havng 2 separate data sources?

  • 11-06-2008 10:20 PM In reply to

    Re: Auto populate - only adds data from first row in database

    Hi Hiszorn,

    Please try the following steps:

    1. Double-click on your Dropdown 1 in the view.
    2. In the ListBox entries section, select 'Look Up Values from an external data source', select Contracts as your Data Connection
    3. Click the XPath button to the right of the Entries field. From the dialog box that appears choose your Contracts table and click OK
    4. Click the XPath button to the right of Display Name, select the Contracts field as value to display, and then click OK.
    5. Click Apply, and then click Rules.
    6. Click Add and then click Add Action.
    7. Select Set A Field’s Value from the action drop-down list, and then click the XPath button to the right of Field.
    8. Select /my:myFields/my:<your Dropdown 2> from the list, and then click OK.
    9. Click the formula button to the right of Value, click Insert Field Or Group, select your secondary connection for Contracts table in the Data Source drop-down, and select the node for SalesPersonID in the list and click Filter Data. Click Add
    10. In the first dropdown, select SalesPersonID and leave the second dropdown 'is equal to'.
    11. In the third dropdown, click 'select a field or a group' from dropdown and select Contracts field from your main data source. The formula will look like @SalesPersonID[. = Contracts]
    12. Click ok on all dialog boxes and preview

    When a contract is selected from Dropdown 1, the steps above should take SalesPersonID from Dropdown 1 and set it as value for Dropdown 2

    Hope this helps.

    Jo-Anne AlfafaraQdabra® Softwarewww.qdabra.com / www.InfoPathDev.com
    The InfoPath Authority – Streamline data gathering to turn process into knowledge.™

     

    Jo-Anne Alfafara / Test Engineer
    Qdabra® Software / Streamline data gathering to turn process into knowledge
Page 1 of 1 (10 items)
Copyright © 2003-2007 Qdabra Software. All rights reserved.
View our Terms of Use.