Managing alias data with Lua scripts


#1

I am using Lua scripts to postprocess some data coming in at ten minute intervals from a device. While debugging the postprocessing code, there were some unwanted datapoints saved to a portal alias at irregular intervals.

Is there any way to remove, or overwrite to an alias at particular timestamp using Lua scripts without deleting the entire alias history? Thanks for any insight!


#2

Hi Ty,

Thanks for posting!

You sure can delete values with a Lua script; Indexing an alias with a given timestamp and setting that datapoints value to nil should delete it.

This would look like:

mydataportAlias[TimeStamp] = nil

Replacing nil with an appropriate value would instead overwrite the value of the targeted datapoint.

More information on the operations available in our Lua engine’s Alias table can read here: http://docs.exosite.com/scripting/#the-alias-table

Is this a one-time operation, or will you find yourself doing this regularly? We also support the ability to flush periods(essentially slices) of data through our RPC API. Flush allows you to define starting and ending bounds to delete all datapoints in that window.

Good luck & happy developing,
-Martin


#3

Bingo, nil works! It is a one time thing, but good to know there are other options through the API.

Cheers