How to link a Query for Data rule with field - InfoPath Dev

InfoPath Dev

Use our Google Custom Search for best site search results.

How to link a Query for Data rule with field

Last post 05-15-2024 03:31 AM by Mohammad Hawasli. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 01-26-2016 04:35 AM

    How to link a Query for Data rule with field

    I'm trying a solution read elsewhere on this forum that describes how you can avoid waiting for a very slow receiving secondary data connection and use Query fields to filter out the data. I'm having trouble with the second step "Create a Query for data rule" which brings the matched data into the Query field, then supposedly a third rule I would need to create which would populate the field I'm trying to populate!

    I have a simple field which a user has to type a number into. This field currently has a rule:

    When field changes:

    1. Set Department field where match to a Secondary Data source is valid
    2. Set Job Title field where match to a Secondary Data source is valid etc...

    This all works but is extremely slow and quite often times out with InfoPath errors. I think the solution is use Query fields above but as I said I'm struggling to understand the steps provided by another user on this forum. There is no explanation on how to use the Query for Data rule alongside the other rules.

    Hilary? Or anyone? 

    Any help? :)


  • 01-26-2016 07:58 AM In reply to

    Re: How to link a Query for Data rule with field

     So - the basics are:

    1. When you create your secondary data connections (SharePoint list or library, InfoPath 2010 or greater), set them to not run on load - there is a checkbox in the final dialog that controls this.
    2. When your field changes, set the query field that corresponds with that number (I don't know what the number corresponds with in your secondary connections, but I'm assuming something, based on your description) in the secondary data connection
    3. Run the query for the secondary data connection

    Then, the secondary data connection will ONLY have the data that matches on that field.

    Now - in order for you to understand query fields better, here is what I suggest you do.

    Drag the ENTIRE secondary data source onto the form - query and data fields.

    In the query field section, add a button. On the button, set a rule to query the data source.

    Preview the form, and try setting different query fields and clicking the button so you can see the returned data.

    Make sense? 

    Hilary Stoupa

  • 01-27-2016 03:52 AM In reply to

    Re: How to link a Query for Data rule with field

    Great Hilary - your comment "Set the query field that corresponds with that number" (and the help from Theolunus) helped me to achieve it. It really is rather simple when you do it yourself. It "clicked" when I thought of and executed it this way: 1. Which field is the trigger for the data connection? In my case it was a Job reference field the user enters a job ref. 2. Then this field is where the rule should be. 3. Use "Set a Fields Value" rule to set the Query field of the Secondary data connection with the value that the user enters. In my case it was set ref(secondary) with Jobref(Main) 4. Use "Query for data" rule below Set a Fields value, which simply queries the data connection. 5. Now use "Set a Fields Value" rule again underneath the Query for Data rule. In this rule, set the main field that you want to populate with the same data field in the Secondary data connection. In my case I needed to populate a Job title field so I set the job title field in the form to the value of the job title field in the Secondary Data connection - it was the data field NOT the query field. 6. Do the same for all the other fields you need to populate. I found it easier to understand if I thought of it like a mini database where you send a query to the database and get results. The problem is figuring out which inlet to send your query and which outlet to get your result from. Also where do you put the Query for data rule? Put it below the initial query rule - remember, you aren't receiving data with this first rule, you are sending it when the field changes. Once sent, use a query for data rule to bring back that query and then spray your form with the right data! I hope this helps others. Thanks again and again!
  • 05-15-2024 03:31 AM In reply to

    Re: How to link a Query for Data rule with field

    Thank you very much, Hilary
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.