Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
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
Solved! Go to Solution.
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.
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.
This does eventually work (data shape gets set properly), but it causes the following error to be printed in the application log: "Invalid DataShape [] assigned to DataTable TestDataTable". I believe it is because the thing initially gets created without the data shape. Is there a more elegant way to do it without such error?
Hi, No there isn't any other more elegant way of doing it, neither I like it.