5 Replies Latest reply on Jul 27, 2016 3:38 AM by jnair RSS
    jnair Explorer

    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

      • Re: Java edge sdk: Infotable values are not getting updated
        Sajid Patel Apprentice

        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.

        • Re: Java edge sdk: Infotable values are not getting updated
          meghan Communicator

          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

          • Re: Java edge sdk: Infotable values are not getting updated
            jnair Explorer

            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