Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

Data Archive Reference

Change and delete events in PIARC table

  • Last UpdatedOct 10, 2024
  • 2 minute read

Use the following commands to add, edit, and delete events. Always back up your data before deleting.

We strongly recommend that you practice deleting small amounts of data on a test system before deleting real data.

You cannot undo a delete with any utility. Deleting large amounts of data may affect availability of an online Data Archive server. If you are considering deleting data in bulk, understand the root cause and consider alternatives, such as using appropriate exception and compression settings, increasing the available disk space, moving older archives to a second tier storage, and so on.

There are several the Knowledge Base articles that provide information about using piconfig, PI OLEDB Provider, or PowerShell to delete events.

Subject of article

Link

For introductory information about using a tool to delete events

How to delete archive and snapshot events

Using piconfig to delete large amounts of data

How to delete archive and snapshot events with PIConfig

Using PI OLEDB Provider to delete events

How to delete archive and snapshot events with PI OLEDB Provider

Using PowerShell to delete events

How to delete archive and snapshot events with PowerShell

In remove mode, both value and time must exactly match the existing event. If the timestamp contains subseconds, consider expanding time resolution with the timf command in order to make an exact match. For details, see Use the TimeFormat command. Similarly, the number of decimal digits might need to be increased for floating point values using the sigd command.

@table piarc
@mode edit,t
@istructure tag, value, time, mode
string1,some text,11:45, append
realtag,12.5,10:44, replace
inttag, 10, t, remove

When adding a new archive event with the edit modes above, you must use:

@mode edit,t

or

@mode create,t

You can use the piconfig selection and modification. For example, to list some events to a file called labevents.txt, create an input file (input.txt) with the following content:

@istructure tag, starttime, endtime, count
@ostructure tag, value, status, time
@ostructure ...
@output labevents.txt
labtag,t,y,100

Then redirect this input file into piconfig:

* (Ls - PIARC) piconfig < input.txt

Now you can change or delete all these events. For example:

@mode edit
@istructure tag, value, status, time
@modify value*= 1.1, mode=replace
@input labevents.txt

This increments all the previously selected events by 10%.

To delete all events for a specified time range (such as for the last 7 days) for a given tag, place the following script in a file called delevents.dif. The script in this example deletes up to 10000 events, but you can change the value in the script. The default number of events is 100.

@table piarc
@mode list
@istructure tag, starttime, endtime, count
@ostructure tag, time, value
@ostructure ...
@timf 9
@sigd 9
@output tmpdelevents.dat
%1%,%2%,%3%,10000
@output
*@exit - uncomment this to exit and review before deleting
@mode ed,t
@modify mode=remove
@istructure tag, time
@input tmpdelevents.dat
@exit

Then invoke piconfig as follows:

* (Ls - PIARC) piconfig input delevents.dif,mytag,t-7d,t

To ensure that the input file and its parameters are taken as one parameter, do not include spaces between parameters.

TitleResults for “How to create a CRG?”Also Available in