Java - Empty InfoTable
I'm trying to create InfoTable in Java, but it's always empty. What do I do wrong?
Created "ThingWorx Extension Project" in Eclipse 2022-03 with "ThingWorx Eclipse Plugin 9.0.1" installed, using SDK 9.2.0, Gradle 6.9.1 and Amazon Corretto 11.0.10.
public static void main(String[] args) throws Exception {
// Create InfoTable
DataShapeDefinition ds = new DataShapeDefinition();
ds.addFieldDefinition(new FieldDefinition("field1", BaseTypes.NUMBER));
InfoTable table = new InfoTable(ds);
ValueCollection row = new ValueCollection();
row.SetNumberValue("field1", 1);
table.addRow(row.clone());
}
Also, tried `new InfoTableFunctions().FromJSON(myJsonInfoTable)` and it doesn't work too.
// Create InfoTable from JSON
JSONObject infoTableJson = new JSONObject("{\"dataShape\":{\"fieldDefinitions\":{\"id\":{\"name\":\"id\",\"description\":\"id\",\"baseType\":\"STRING\"}}},\"rows\":[{\"id\":\"someString\"}]}");
InfoTableFunctions fns = new InfoTableFunctions();
InfoTable table = fns.FromJSON(infoTableJson);

