cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Java edge sdk: Infotable values are not getting updated

jnair1
1-Newbie

Java edge sdk: Infotable values are not getting updated

Hello,

In the java edge sdk, I have an Infotable property defined using:

@ThingworxPropertyDefinition(name = "infotable", description = "Device Configurations", baseType = "INFOTABLE", category = "Status", aspects = {

  "dataChangeType:VALUE", "isReadOnly:false" })

I have also defined an Infotable variable with multiple rows and columns and I am updating this infotable using:

infotable.getRow(0).setValue("identifier", value).

The infotable property is updated to the server using:

this.setPropertyValue("infotable", new InfoTablePrimitive(infotable));

super.updateSubscribedProperties(10000);

My problem is even though the local infotable values are changed these values are not getting updated on the server. Other properties with baseType STRING or NUMBER are working fine. Anybody have an idea why the infotable property is not getting updated?

Thanks and regards,

Jishnu Nair

1 ACCEPTED SOLUTION

Accepted Solutions
jnair1
1-Newbie
(To:jnair1)

I have found the issue. Actually the server was always accessing the cached value of Infotable. By setting  "cacheTime:-1" at property definition resolved the issue.

Regards,

Jishnu

View solution in original post

5 REPLIES 5

Any errors in the application logs or SDK logs?   

   

If infotable is already of type 'com.thingworx.types.InfoTable', you need not use new InfoTablePrimitive(). I am assuming that other property types are working fine, if not, you might have more general connectivity issue.

Hi Sajid,

There is no connectivity issue and other properties are working fine. The initial value of Infotable get updated to the server, but any subsequent changes are not get updated.

Regards.

Jishnu Nair

mhollenbach
5-Regular Member
(To:jnair1)

Jishnu,

You are going to want to do this a bit differently than what you wrote above (I've taken this from the SteamThing.java file included with the Java SDK).

Create an instance of a new InfoTable by assigning it a DataShape:

          InfoTable table = new InfoTable(getDataShapeDefinition("SteamSensorReadings"));


Create a ValueCollection that you will populate with entries:

          ValueCollection entry = new ValueCollection();


Add entries to the ValueCollection object you just created:

          entry.SetStringValue(SENSOR_NAME_FIELD, "Sensor Alpha");

          entry.SetDateTimeValue(ACTIV_TIME_FIELD, now.plusDays(1));

          entry.SetNumberValue(TEMPERATURE_FIELD, 50);

          entry.SetNumberValue(PRESSURE_FIELD, 15);

          entry.SetBooleanValue(FAULT_STATUS_FIELD, false);

          entry.SetBooleanValue(INLET_VALVE_FIELD, true);

          entry.SetNumberValue(TEMPERATURE_LIMIT_FIELD, 150);

          entry.SetNumberValue(TOTAL_FLOW_FIELD, 87);


Add the new entry to the InfoTable as a new row:

          table.addRow(entry.clone());


You should then call the setProperty method to set the InfoTable property to the table you just created:

          super.setProperty("TableProp", table);


Finally, exactly as you had above, send the property updates

          super.updateSubscribedProperties(10000);

Meghan

Hello Meghan,

Thank you for suggesting the correct approach to creating Infotables.

Regards,

Jishnu

jnair1
1-Newbie
(To:jnair1)

I have found the issue. Actually the server was always accessing the cached value of Infotable. By setting  "cacheTime:-1" at property definition resolved the issue.

Regards,

Jishnu

Top Tags