Create InfoTable using Java Extension SDK
Hi,
I am having troubles creating Infotable objects using the Thingworx Extension SDK. I have tried multiple methods and no seem to work.
Using From JSON
I tried to use the fromJSON method but i didnt work.
JSONObject jsonObj = new JSONObject("{\"dataShape\":{\"fieldDefinitions\":{\"id\":{\"name\":\"id\",\"description\":\"id\",\"baseType\":\"STRING\",\"ordinal\":0,\"alias\":\"_0\",\"aspects\":{}}}},\"rows\":[{\"_0\":\"178498585\",\"_1\":1531849323285,\"_2\":true},{\"_0\":\"178496396\",\"_1\":1531849187726,\"_2\":false},{\"_0\":\"178482871\",\"_1\":1531848400119,\"_2\":true}]}");
InfoTable it = InfoTable.fromJSON(jsonObj);
Building From Scratch
I have tried to build the InfoTable from scratch but no methods work.
1) Create Field Definition and using addField
InfoTable myIF = new InfoTable();
FieldDefinition Field1 = new FieldDefinition("Field1", BaseTypes.INTEGER);
myIF.addField(Field1);
2) Create DataShapeDefinition -> Add field to that definition -> use infotable constructor with the data shape definition as input. I have also tried to use BaseTypes.String.
DataShapeDefinition dsd = new DataShapeDefinition();
dsd.addFieldDefinition(new FieldDefinition("MockedField", "STRING"));
//also tried
dsd.addFieldDefinition(new FieldDefinition("MockedField", BaseTypes.STRING));
InfoTable it = new InfoTable(dsd);
What is the correct way to create the InfoTable Object?
Thanks!

