Skip to main content
10-Marble
February 14, 2023
Solved

Does DataShape does not support property name having hypen?

  • February 14, 2023
  • 2 replies
  • 1111 views

var result = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape({
dataShapeName: "TestDataShape"
});
var newEntry=new Object();
for(var i=0;i<result1.length;i++){
newEntry.first-data = result1[i].first-data;
                   .

                   .

                   .
result.AddRow(newEntry);
}

 

 

 

Does DataShape does not support property name having hypen? ie.newEntry.first-data 

and my second question is does result1[i].first-data;is not supported in thingworx?  result1[i].first-data is coming from json file 

 

Can you help me out over here ?

 

Best answer by DanZ

That has nothing to do with Thingworx, but you need to use the bracket notation to access such a property:

 

 

const firstData = result1[i]['first-data']

 

2 replies

17-Peridot
February 14, 2023
  • We can create data shape name with hyphen "-"

Sathishkumar_C_0-1676358851343.png

 

 

 

 

 

 

 

 

 

 

What you trying with... newEntry.first-data = result1[i].first-data; ?

Can I have sample date of result1 here? Is it a JSON or INFOTABLE?  What is data?

Test_user10-MarbleAuthor
10-Marble
February 14, 2023

Thank you.

result1 has data in JSON format.

DanZ15-MoonstoneAnswer
15-Moonstone
February 14, 2023

That has nothing to do with Thingworx, but you need to use the bracket notation to access such a property:

 

 

const firstData = result1[i]['first-data']