Query XML Secondary Data Source from Text Input Box - InfoPath Dev
in

InfoPath Dev

Query XML Secondary Data Source from Text Input Box

Last post 08-15-2018 01:17 PM by Hilary Stoupa. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 08-13-2018 11:06 AM

    Query XML Secondary Data Source from Text Input Box

    I'm trying to figure out how to query an xml file without using a dropdown box. The user inputs an account number in a text box, clicks the search icon, and it returns name, balance, rate, etc...  It works great with a dropdown (I don't need the search button with the dropdown); but I haven't been able to figure out how to make it look up the account number -- it simply returns the first one in the xml file.  All of my rules are now attached to the search button  - it queries the xml file and then sets several field values based on that query. 

    i.e. SHORT_NAME[ACCOUNT_NUMBER = @Loan_Number]    - I'm not sure if I have the right syntax. 

    Thoughts??

     

    Filed under: ,
  • 08-13-2018 12:01 PM In reply to

    Re: Query XML Secondary Data Source from Text Input Box

    The formula may need the current() function - mind attaching your template under a reply under the options tab and let me know where to look for the rules?
    Hilary Stoupa

  • 08-13-2018 12:22 PM In reply to

    Re: Query XML Secondary Data Source from Text Input Box

    Thanks Hilary, I can probably send the template through a secured link but I can't upload the file from here. Can you share your e-mail?   I used the Current() qualifier in the dropdown but it returned nothing when I changed it to "Query Data".

  • 08-15-2018 09:31 AM In reply to

    Re: Query XML Secondary Data Source from Text Input Box

    It looks like your Loan Number field on your form is bound to the Loan_Number in the dataFields. But if you want to search for a specific loan, based on Loan Number, it should be bound to the queryFields. Right click that field and select Change Binding, rebind to the query fields. Then when you click your search button, the correct data will be automatically returned to your data fields - the only rule you need on your search button should be the Query using a data connection rule.
    Hilary Stoupa

  • 08-15-2018 10:46 AM In reply to

    Re: Query XML Secondary Data Source from Text Input Box

     The form queries the XML file for the Loan_Number (secondary) - not the primary SQL db (the form submits to this db).  InfoPath doesn't give me the option of selecting the query object on the XML file.  I set it up to query the XML in the rules. 

     

  • 08-15-2018 01:17 PM In reply to

    Re: Query XML Secondary Data Source from Text Input Box

    Oh wow - ok, sorry, I hadn't paid close enough attention. So .... you'll be updating that XML file regularly in your form with the most recent data? I'm confused why you are querying the XML data connection at all - that data connection is set to query on load. We don't get query fields in XML connections, so yes, you have to use XPath to return your data. I'm also confused by your second rule action - why are you setting a field in the XML file to the account number entered in the form's data source? I also see that in the XML data, you have spaces padding the number you are matching - you may have to use a translate function to work around that. Your form actually crashes on me when I try to use the search button, but I've added a calculated value to show the XPath and will send it back to you via email.
    Hilary Stoupa

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