Skip to main content
1-Visitor
October 28, 2016
Solved

How to Create Data Table Dynamically?

  • October 28, 2016
  • 1 reply
  • 5288 views

Hi Everyone,

I needs to create data table through service. So to perform this I used the createThing snippet of Thingworx as following:

I added a input parameter "Thing_Name" in my service.

var params = {

  name: Thing_Name/* STRING */,

  description: undefined /* STRING */,

  thingTemplateName: "DataTable" /* THINGTEMPLATENAME */,

  tags: undefined /* TAGS */

};

// no return

Resources["EntityServices"].CreateThing(params);

By the above code my Data table is created but What about datashape? How to add it dyamically at the time of Data table creation?

If anyone has idea about it Please help.

Thanks,

Meenakshi

Best answer by CarlesColl

Hi,

I create a lot of DataTables dynamically, you just need to call Things[newThingName].SetDataShape({ name: "yourDataTableDataShapeName" });

Then do a EnableThing() and a RestartThing()

Carles.

1 reply

1-Visitor
October 28, 2016

Hi,

I create a lot of DataTables dynamically, you just need to call Things[newThingName].SetDataShape({ name: "yourDataTableDataShapeName" });

Then do a EnableThing() and a RestartThing()

Carles.

magrawal1-VisitorAuthor
1-Visitor
November 2, 2016

Thank you so much Carles Coll​,

You saved my time.