cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

How to pass nth row of a infotable as argument.

SM_10230689
11-Garnet

How to pass nth row of a infotable as argument.

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)

ACCEPTED SOLUTION

Accepted Solutions

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)

 

ashaban_0-1654677825025.png

 

ashaban_1-1654677841532.png

 

ashaban_2-1654677848734.png

 

 

ashaban_4-1654677856317.png

 

I hope it helps,

Avihu.

View solution in original post

2 REPLIES 2

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)

 

ashaban_0-1654677825025.png

 

ashaban_1-1654677841532.png

 

ashaban_2-1654677848734.png

 

 

ashaban_4-1654677856317.png

 

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.

Announcements


Top Tags