Community Tip - You can change your system assigned username to something more personal in your community settings. X
Hey all,
A disclaimer: I'm new to Thingworx and have only been doing this for about 3 months.
My problem: I'm trying to take the output of a multi-select combo box and map it into an insert with a javascript/SQL service.
Let me describe what I'm trying to do: I have a combo box that will allow users to select up to six values. I then bind this to an infotable attached to a javascript service as an input parameter. I have each field declared in a datashape that defines the infotable. My javascript then concatenates the values together separated by a '/'. So my output is value1/value2/value3, etc as a text string. I'm trying to combine the 6 selections into a one row insert. The javascript then calls the SQL insert. Both services work fine when I test in the Thing stand alone. The multiple select in the combo box works fine as I can display the selections in a grid. The rub is that I don't know how to get the output from the combo box selected rows into the fields defined in the datashape/infotable. Is there an easier/better solution besides utilizing 6 different drop down widgets to get this to work correctly?
Solved! Go to Solution.
From the Data source that populates your combo box, Are you passing 'Selected Row(s)' back into your service?
This would provide your service an infotable with the selections which you then can iterate to create your parameter payload for your SQL service.
Within a Thingworx SQL service you also have two types of substitution
[[ ]] for strict parameter substitution or
<< >> for string substitution, be careful as this exposes a chance for SQL string injection.
From the Data source that populates your combo box, Are you passing 'Selected Row(s)' back into your service?
This would provide your service an infotable with the selections which you then can iterate to create your parameter payload for your SQL service.
Within a Thingworx SQL service you also have two types of substitution
[[ ]] for strict parameter substitution or
<< >> for string substitution, be careful as this exposes a chance for SQL string injection.
Thanks for your reply! I'll try the <<>> string substitution as well. I also tried to define the parameters in an expression widget and had no luck binding the combo box output to the expression input.