So based on a field in my form, i want to execute a sql query when that field changes.

Ive set up the data connection, but as far as i can see, the connection is static and there is no way to manipulate the query based on the field from my form. Has anyone achieved this, or might someone have a smart solution to this problem?

For me, i cannot understand why this limitation exists, as the whole point about including external datasources for me, would have to be that one can query it based on dynamic parameters.



I would suggest you to use a separate Web Service for getting data to InfoPath.. In Web Service, use Object Model to connect database and query!

Or, if you can do VSTA Code on InfoPath form (needs administrative approval for InfoPath form, each time you publish the form).. Here is an example:
Dynamic SQL Data connection in InfoPath

Seems possible duplicate of:
Filtering Secondary SQL data connection with value from Main data connection

| improve this answer | |
  • Thanks, as the form is for a custom list and from what I understand i can not include VSTA code in my form because of that - The only solution seems to use a web service. – Alexander Sep 3 '13 at 6:17

If you only want to filter your datasource, you can execute the connection for all items, after you get the result of your datasource connection, you can filter the results based on your field on your form. Hope this helps you.

| improve this answer | |
  • Thanks, but sadly I cannot filter, as the datasource is really big(several million items to query)- so I have to apply the "filter" before the connection is made. – Alexander Sep 2 '13 at 7:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.