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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Infotable service output.

Radu
15-Moonstone

Infotable service output.

Hi.

 

If I have a service that returns an infotable, is there any way that I can declare within the service the data shape that it's supposed to return? I'm talking of the field in the photo attached. Is there a way to declare it programatically?

 

I'm asking because within the service I'm removing specific columns based on an input parameter, and I want to bind this output infotable to an Advanced Grid, from where I need to State Format the columns. But if I don't fill in the Data Shape, I won't have access to the "Configure Grid Columns" setting of the Advanced Grid widget.

 

Thank you.

 

Radu_0-1579612590983.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
raluca_edu
17-Peridot
(To:Radu)

Hi,

 

You can use CreateInfoTableFromDataShape to create infotable inside your service and in the end return that infotable in result (last row should be result=myinfotable ). In my case, this worked without giving a specific datashape in the Output window, but I have specified the datashape when I used CreateInfoTableFromDataShape.

 

Hope it helps,

Raluca Edu

View solution in original post

3 REPLIES 3
raluca_edu
17-Peridot
(To:Radu)

Hi,

 

You can use CreateInfoTableFromDataShape to create infotable inside your service and in the end return that infotable in result (last row should be result=myinfotable ). In my case, this worked without giving a specific datashape in the Output window, but I have specified the datashape when I used CreateInfoTableFromDataShape.

 

Hope it helps,

Raluca Edu

Radu
15-Moonstone
(To:raluca_edu)

Hi,

 

Thank you for your answer. This creates me an empty infotable. I want to copy the data from the bigger infotable into the smaller infotable (created with CreateInfoTableFromDataShape). Keep in mind that the bigger infotable has some columns that will not be included in the smaller infotable that I just created using the CreateInfoTableFromDataShare service. How could I proceed?

 

Thank you.

rosharma
16-Pearl
(To:Radu)

you iterate the data from bigger infotable using for loop snippet.(infotable for loop)

get data for all fields inside loop and set it back to fields for smaller infotables which are required( leave fields which are not required)

create small infotable object from available snippet and then you need to create smaller infotable entry using snippet "Create infotable entry from datashape" and what all fields will come here , you need to set those in loop and add it to result (smaller infotable created above) object.

snippet would be like this

 

var newEntry = new Object();
newEntry.address = undefined; // STRING
newEntry.name = undefined; // STRING

result.AddRow(newEntry);

 

basically smaller and big infotables differs as per there datashapes and hence need to set values accordingly.

And all infotable functions are available under services tab --> snippets -->infotable

Top Tags