Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
i want to loop through each row of infotable and pass the whole row as an argument. is it possible in thing worx.
While writing infotable.rows[0] its showing error as : (Error executing service. Message ::Unable To Convert From com.thingworx.types.collections.ValueCollection to INFOTABLE)
Solved! Go to Solution.
Hi @SM_10230689 ,
I can think of two easy ways:
1. You can create a temporary info table with a single row (the row you would like to pass) and The called service will define an info table input parameter and access the first row.
2. Since the row is a JSON object, create a JSON object type parameter on the receiving service and pass the row.
Example attached: (Note: I'm not sure what is your ThingWorx Composer version so the syntax might vary)
Thing rowParamter
two services:
1. getInfoTableOrJSON with two inputs (INFOTABLE and JSON) that will print the value of the name
2. test get an info table as input and send each row as an info table and row to getInfoTableOrJSON.
To test:
execute the test service and provide a row (use the Add+)
See the script log prints (it is an error just for visibility)
I hope it helps,
Avihu.
Hi @SM_10230689 ,
I can think of two easy ways:
1. You can create a temporary info table with a single row (the row you would like to pass) and The called service will define an info table input parameter and access the first row.
2. Since the row is a JSON object, create a JSON object type parameter on the receiving service and pass the row.
Example attached: (Note: I'm not sure what is your ThingWorx Composer version so the syntax might vary)
Thing rowParamter
two services:
1. getInfoTableOrJSON with two inputs (INFOTABLE and JSON) that will print the value of the name
2. test get an info table as input and send each row as an info table and row to getInfoTableOrJSON.
To test:
execute the test service and provide a row (use the Add+)
See the script log prints (it is an error just for visibility)
I hope it helps,
Avihu.
Hi ashaban,
Thanks, the first approach worked, (create a temporary info table with a single row (the row you would like to pass) and The called service will define an info table input parameter and access the first row).
Thanks.