Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
I'm trying to create an infotable from a JSON array that is in a logged property. The problem is that one of the elements in the array has a dash in the name ("arc-time"). I cannot change the element but can't get it to come through. The following code gives me an error: "missing name after .operator". Any ideas?
var obj= me.ErrorHistory;
var params = {
infoTableName: "InfoTable",
dataShapeName : "ErrorHistory_Shape"
};
var infotabletest = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params);
for(var i=0; i<obj.array.length; i++)
{
infotabletest.AddRow({"id":obj.array.id,"type":obj.array.class,"arctime":obj.array.["arc-time"]});
}
var result= infotabletest;
Solved! Go to Solution.
When you get a field value with ["arc-time"] no "." should be written, then your instruction should be:
infotabletest.AddRow({"id":obj.array.id,"type":obj.array.class,"arctime":obj.array["arc-time"]});
What is your Thingworx platform version?
I will recreate, and if a bug is confirmed, submit a jira.
When you get a field value with ["arc-time"] no "." should be written, then your instruction should be:
infotabletest.AddRow({"id":obj.array.id,"type":obj.array.class,"arctime":obj.array["arc-time"]});
That worked Carles!. I knew it was something small. Thanks!