Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
Hi, guys!
I've got some problems when I create a infotable.
Here is the following service I use:
var infotable1Object = {dataShape: {fieldDefinitions :{} }, rows: [] };
infotable1Object.datashape.fieldDefinitions['name']={name: 'name', baseType: 'STRING'};
infotable1Object.datashape.fieldDefinitions['value']={name: 'value', baseType: 'STRING'};
var newROW= new Object();
newROW.name="abcde";
newROW.value="12345";
infotable1Object.rows[0]=newROW;
var params = {
json: infotableObject /* JSON */
};
// result: INFOTABLE
var result = Resources["InfoTableFunctions"].FromJSON(params);
the result is always:
TypeError: Cannot read property "fieldDefinitions" from undefined (CreateInfo#1)
The easiest way to create an infotable would be to define a DataShape and then use CreateInfoTable from DataShape
Fool Proof that way!
If you do a straight up infotable, use AddField instead of the definitions as you are calling.
I believe someone posted a really nice piece already in the community or in a blog on infotables.
Hi, Pai.
Thanks for the information, but the isn't from me.
It is from PTC, thingworx market's CSV file.
There is a PDF file that show me the example of how to write a CSV file.
But it just can't work. I'm confused.
http://marketplace.thingworx.com/wp-content/uploads/2015/09/CSV-Parser-Extension-User-Guide.pdf
Lee, another quick thing - you've used var infotable1Object, but in the json content you've used infotableObject instead.
Hi, Aanjan
After I fix the bug, it stills result TypeError: Cannot read property "fieldDefinitions" from undefined (WriteCSV#3)
Guys, I found out the problem, a stupid mistake!
Thanks, though.