Selected fields in listbox to SQL Query
I would like to be able to pick and choose from a list of fields on a form (listbox with fields from an Oracle table), run a SQL query, and output the results to an XLS file. I have a workflow that accomplishes this using hard-coded field names, but ultimately I would like only those selected fields in the list to be used in the SQL Select st atement (dynamically). Only a few of those fields need to be used as parameter values. Has anyone had experience with this or are able to point me in the right direction?
Thanks,
Andrew
Using Manager 3.14, Silverlight 1.9
-
If I understand what you want to achieve correctly, it is not possible to make it work using the Geocortex Essentials (GE) Workflow Default Database activity (SQL Query) since the parameter you set is only for WHERE clause, not SELECT clause to prevent the SQL Injection.
You want to construct this kind of SQL statement, right? "SELECT [dynamic Field Names] FROM aTable" where [dynamic Field Names] are chosen by a user on the UI Form (ListBox).
You can achieve this using your own custom CodeActivity where take the Sql statement (dynamic), and connect DB, and query, and return the result to the workflow. However, becareful to avoid SQL insection.
0 -
Thanks for the reply. Yes that's exactly what I was thinking. Just to be clear, from what you mentioned below I would need to somehow loop through the field names that are selected to come up with dynamic SELECT/WHERE strings, run the SQL statement with the dynamic strings inserted, and return the results? It's the looping part that I'm not entirely familiar with yet.
0
Please sign in to leave a comment.
Comments
2 comments