Filter Workflow: convert datatable to object?
Hello. I'm trying to create a filter list from the results of a SQLQuery (that returns a single field), however I cannot seem to convert the Object (query results table) to IList<Object> needed for the filter expression. Workflow below...any direction is appreciated!
Workflow: https://geosyntec-my.sharepoint.com/:u:/p/jrosen/EfY_X2Mk1u1BjIYCCs_RxjoBbN7qyaDPHCRHgRMX4CEJBQ?e=gYgLwq

0
-
You are trying to cast the datatable returned by the SqlQuery activity to some sort of enumerable object, which is not possible.
Instead, loop over the rows property and get the values from there.
- Make sure System.Data and System.Xml is added to the list on the Import tab
- The For Each activity loops over datatable1.Rows.OfType(Of DataRow)
- The Add To Collection activity adds "'" & CStr(row.Item(0)) & "'" to a variable of type List(Of String) named values
- The value assigned to filter is "Location in (" & String.Join(",", values) & ")"
0 -
Thanks so much for the detailed response.
I am unable to populate the AddtoCollection code though. Are you able to see my error? Have I used the wrong "List(Of String)" type?
0 -
Your screenshot is barely readable, but I think you can spot the difference yourself if you look closely.
Compare
AddToCollection<String>
To
AddToCollection<List<String>>0 -
thank-you! 0
Please sign in to leave a comment.
Comments
4 comments