Skip to main content
1-Visitor
August 4, 2017
Solved

Infotable data loss

  • August 4, 2017
  • 1 reply
  • 2618 views

Hello there,

I've just lost a month's worth of data which is stored in Thing's infotable property. It happened to me few times and I cannot pinpoint what exactly is causing it.

Most often it happens in the 'edit' mode, though the work conducted has nothing to do with that infotable. The property is set as persistent. The infotable is part of the ThingShape which in turn is inherited by the ThingTemplate. An entry is made on an hourly basis by a service.

Does anyone know why it happens and how to prevent such events?

What happens when the service creates an entry in the infotable, the thing is in the 'edit' mode and the user clicks 'cancel'?

Tomcat 8.0.38, psql 9.4.11, Win 2012 r2

Thanks.

Best answer by CarlesColl

Ok the code it's wrong

Persistence on Infotable Properties only happens when there's a DataChange event, and the way you are adding rows doesn't throws data change event o that property.

To ensure a DataChange event it's thrown on a Infotable Property you must rewrite the whole property not just adding a row.

Then the correct code for interacting with a Persistent Infotable Property it's:

var copy = Resources["InfoTableFunctions"].Clone({ t1: me.myInfoTableProperty });

var newEntry = { };

copy.AddRow(newEntry);

// -- And this is the key to force persistence

me.myInfoTableProperty = copy;

1 reply

1-Visitor
August 4, 2017

First of all, Infotable properties aren't designed to store hourly basis data, that's a lot of data for a Infotable Property ( they keep in memory... )

Anyway, how it's your code that records hourly basis data on the infotable property?

Michail1-VisitorAuthor
1-Visitor
August 4, 2017

Carles Coll​, thanks for reply!

The code for creating an entry is pretty simple.

Scheduler->Service->'NewEntry' object->AddRow

var newEntry = new Object();

newEntry.someField = someValue;

...

me.HourlyTable.AddRow(newEntry);

Is there a figure for the infotable size limit? Making it a data-table, would it help? Cheers

1-Visitor
August 4, 2017

Ok the code it's wrong

Persistence on Infotable Properties only happens when there's a DataChange event, and the way you are adding rows doesn't throws data change event o that property.

To ensure a DataChange event it's thrown on a Infotable Property you must rewrite the whole property not just adding a row.

Then the correct code for interacting with a Persistent Infotable Property it's:

var copy = Resources["InfoTableFunctions"].Clone({ t1: me.myInfoTableProperty });

var newEntry = { };

copy.AddRow(newEntry);

// -- And this is the key to force persistence

me.myInfoTableProperty = copy;