Secondary Data Connections - How to query\filter? - InfoPath Dev
in

InfoPath Dev

Secondary Data Connections - How to query\filter?

Last post 12-30-2011 11:11 PM by Jo-Anne Alfafara. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 12-27-2011 09:18 AM

    Secondary Data Connections - How to query\filter?

    Ideally, I'm looking for a way to use InfoPath 2007 to display main and secondary data connection results based on the query value for the main data connection.

    When I added a secondary data connection, I noticed InfoPath is not displaying the queryFields option for this data connection.  The connection shows dataFields, but not the queryFields section??

    I can explain further.  My main data connection has a query field named Account Number.  The user will enter an Account Number in this query field and then click the Run Query button.  InfoPath then displays the data field values for the main data connection in my form based on this account number.

    I then added a second data connection to a different sql server that also stores information about the account.  I added the data fields for the secondary data connection onto my form. I have the secondary data connection set to Automatically retrieve data when the form is opened.  Now when I run the query, the secondary connection data fields display all records from these tables, instead of only the record(s) that match the Account Number specified.

    How would I go about having my secondary data connection data fields apply the account number logic the main connection is using?

    Thanks

  • 12-30-2011 11:11 PM In reply to

    Re: Secondary Data Connections - How to query\filter?

    Hello,

    You can use the fields in your main data source to display the values from your secondary data connection. Open the rules for your query button and add an action to set a field's value. Select the field from your main data soure to display the value to, you can do that by clicking the modify button next to the Field text box. In the Value text box, click the fx button, click on Insert Field or Group... and then select the field in your secondary data connection (just click it). Click Filter Data. Click Add. From there you need to specify a filter condition such that the Account Number (secondary) is equal to the Account Number (main). Click OK to the dialog boxes, and repeat that to the rest of your fields. Take note that those actions need to be under the action rule that queries your secondary data source. That should do it.

    Please modify your secondary data connection to uncheck the "Automatically retrieve data when form is opened", you don't need that since the form is dynamically setting the values.

    Let me know if that works.

     

    Jo-Anne Alfafara
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.