How to update Infotable property using service in extension ?
Hello all,
I'm trying to update Infotable property value using "UpdatePropertyValues" service. When I run the code, I'm getting error as "Unable To Convert From java.lang.String to INFOTABLE". Below is my code,
DataShapeDefinition updatepropertyShape = new new DataShapeDefinition();
updatepropertyShape.addFieldDefinition(new FieldDefinition("name",BaseTypes.STRING)); updatepropertyShape.addFieldDefinition(new FieldDefinition("time",BaseTypes.DATETIME)); updatepropertyShape.addFieldDefinition(new FieldDefinition("quality",BaseTypes.STRING)); updatepropertyShape.addFieldDefinition(new FieldDefinition("value",BaseTypes.STRING)); InfoTable updateproperty = new InfoTable(updatepropertyShape); Calendar currenttime = Calendar.getInstance(); JSONObject values = new JSONObject(); values.put("time", new DateTime(currenttime)); values.put("quality", "GOOD"); values.put("name", "MBT_CapacityOfMachine"); values.put("value", parsedValue); //ParsedValue is Infotable updateproperty.AddRow(values); thingName.UpdatePropertyValues(updateproperty);
I tried using "setPropertyValue" in service, I'm getting error as "com.thingworx.types.InfoTable cannot be cast to com.thingworx.types.primitives.IPrimitiveType"
thingName.setPropertyValue("Prope1", (IPrimitiveType<InfoTablePrimitive,InfoTable>) propertyValue);
Can any one help me to fix this issue ?
Regards,
VR

