Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
Good morning,
I have been working with Thingworx for a while now, but I haven't been able to make this work. I have a service that gets data from a Stored Procedure, I show it on a Grid widget, modify and add new data, and I need to send it to SQL again. My problem is that I have all that data on a Infotable, and I haven't been able to pass that data to the stored procedure. My plan was to run through the infotable with a loop and a counter "EditedGridData.rows[counter].parameter" (something like in the example in the image) but it doesn't work. I know that it works with just strings, numbers and booleans as inputs, but I have 4 infotables like this one, with 6-10 parameters each, so it would need to have about 35 services just for that.
Other solution that I thought of was to use a second Service that have the Infotable as output, output each row once and call the SQL Query once for each row, linking the parameters inside as different inputs (string, bools, ints). With this solution I don't have the problem of needing a crazy amount of different Services, but I need to run both of them once per row, so with the 4 infotables that I have, I would end up running between 10-15 times each one (number of rows that I usually need), so I'll end up running a full service about 100 times
(12rows * 2services per infotable * 4infotables), which would decrease the performance a lot.
Is there any way I can make this work without any of those problems (crazy amount of services or crazy amount of runs)? I thought about using the properties of the Thing in which I have the SQL Querys, but I haven't been able to call them from SQL Query code.
Regards,
Josue Nanin
my knowledge of SQL isn't good enough, but I'm pretty sure that since you have the datashape of the infotable you can create a very generic 'parser' to set up the SQL payload.
Hello Pai,
Thank you for answering. If you mean that I put together every cell of a column separated by commas for example, and that SQL "decode" it, I thought about that possibility, but I am not the designer of the Stored Procedures, so for each change I would need to go through 3 people, which is, sorry for the expression, a pain in the ass.
Let's hope there is a more elegant solution
Were you ever able to resolve this without modifying the stored procedure? I have the same need.