How to query multiple parcels from user input string?
I need to create a workflow that allows the user to paste a string of comma separated Parcel ID's (e.g. 1610229011000,1610229012000,1610229013000) into a query form, and then query all Parcel ID's. Each Parcel ID will need to be modified to be wrapped by single quotes (e.g. '1610229011000','1610229012000','1610229013000') and then build the query expression like so: PID IN ('1610229011000','1610229012000','1610229013000'). Is there a way to do this?
Thanks,
-
@Doug Guess? Yes, could do this by using a Split method to break the value into a list with commas as the separators, and a Join method to combine the list back into a string with ',' as the separator. Or a text replace that replaces , with ',' could also work if you don't need to do anything fancy with that list of values. I've attached a quick example with Geocortex Workflow - use File >Import to import it, and then run it in the Sandbox.
0 -
Thanks for the reply Amanda. I'm using Workflow Designer, not Workflow 5. Can I still utilize your sample?
0 -
In workflow 4 you could take a similar approach, the most straightforward way would be something like this:
where = "PARCELID IN ('" & userIds.Replace(",", "','") & "')"Or, if you don't want to be too strict on the specific format a users types in, you could fix extra whitespace and trailing or double comma's by doing something like this:
where = "PARCELID IN (" & String.Join(",", userIds.Split({","c}, StringSplitOptions.RemoveEmptyEntries).Select(Function(id) "'" & id.Trim() & "'")) & ")"0 -
Berend,
That worked perfectly! thanks
0
Please sign in to leave a comment.
Comments
4 comments