Automate 'Run Query' - InfoPath Dev
in

InfoPath Dev

Automate 'Run Query'

Last post 01-06-2006 05:13 PM by Matt Faus. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 01-05-2006 12:47 PM

    Automate 'Run Query'

    Hi,
    I have a simple form connected to a web service. When I click 'Run Query' it fills out the fields on the form as expected, but I would like the fields to be automatically filled in when the form loads and remove the 'Run Query' button. What code is required to do this?

    Thank you!
  • 01-05-2006 01:39 PM In reply to

    In the OnLoad event handler call the XDocument.Query() method for the associated Data Connection.

    ---------------
    Matt Faus
    InfoPath Dev Texas
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 01-06-2006 04:14 AM In reply to

    Thanks for your response. I'm sorry, but I have no idea how I would access the associated data connection or how I would then run XDocument.Query() for that connection. Could you please either point me to some documentation or provide a bit of code?

    Thank you
  • 01-06-2006 07:04 AM In reply to

    Sure thing. If the Web Service is used as your main DOM (via New form from Data Connection -> Web Service), then you should be able simply add XDocument.Query() to the OnLoad event handler as mentioned above. To do this Chooose Programming | On Load Event from the Tools Menu and type XDocument.Query() into the function that is generated in the Microsoft Script Editor.

    If you are using a Web Service (or any other data connection ) as a secondary data source you will have to use a slightly more specific code snippet:
    var webService = XDocument.DataObjects( "Name of your Data Connection" );

    webService.Query();


    If you have not downloaded the InfoPath SDK (which is where all of this information came from), I would highly recommend it. A link can be found on the left side of this page.

    Hope this helps, let us know if you have any more questions!

    ---------------
    Matt Faus
    InfoPath Dev Texas
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 01-06-2006 09:07 AM In reply to

    Thank you, this is a great help!
  • 01-06-2006 05:13 PM In reply to

    No problem, let us know if you have any other questions!

    ---------------
    Matt Faus
    InfoPath Dev Texas
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
Page 1 of 1 (6 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.