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

How do I clear contents of Edge-created infotable object?

Highlighted
Visitor

How do I clear contents of Edge-created infotable object?

Hi all,

In my Edge code (using WS-EMS and Lua Script Resource), I am using code similar to the following to store values to an infotable I have created like that.

dataShapes.GasLogEntry(

  { name = "Timestamp", baseType = "INTEGER" },

  { name = "Channel", baseType = "INTEGER" },

  { name = "GasReading", baseType = "NUMBER" }

)

...

tw_mutex.lock()

local gasDS = DataShape.GasLogEntry:clone()

tw_mutex.unlock()

local gasIT = tw_infotable.createInfoTable(gasDS)

and then the following to add rows to that infotable

local success, err = gasIT:addRow({

  Timestamp = GasLogTime,

  Channel = 100, --channelIterator,

  GasReading = varGasReading

   })

However, I cannot seem to find a way of clearing rows inserted into the infotable. As I use this infotable to send accumulated data (within this infotable) on-demand to the platform, then clearing and re-using it multiple times, what I use right now to empty my infotable and re-initialise it is breaking the link to the infotable object by pointing the variable previously bound to it to a freshly instantiated infotable each time, assuming the garbage collector will get rid of the redundant object. However, I am suspecting I may be running out of memory gradually as I find the machine running the EMS and LSR has crashed after several hours (during which I have emptied and re-used the same table about a couple of hundred times).

So my questions are these:

     1. Is there a way to go through the infotable and remove rows one by one? Is there something like i.e. gasIT:removeRow? I ahven't found anything in the documentation.

     2. Even if I left my code as-is, wouldn't the garbage collector tidy up the leftovers? It's really frustrating to have the whole EMS/LSR processes going down and taking the machine down with them (crashing).

I would really appreciate any help, thanks in advance.

Marios

Tags (1)
Announcements

Thingworx Navigate content has a new home! Click here to access the new Thingworx Navigate forum!