Infopath querying secondary datasource based on fields in main data connection
-
10-12-2019 - |
Question
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.
Solution
Alexandar,
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
EDIT
Seems possible duplicate of:
Filtering Secondary SQL data connection with value from Main data connection
OTHER TIPS
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.