DELETEARCHDATA action


Function Deletes the data of a historical value within a time interval.
Declaration
DELETEARCHDATA archIdent, timeFromIdent_TmA, timeToIdent_TmA [,statusIdent_Int]
or
 
DELETEARCHDATA archIdent, timeFromIdent_TmA, timeToIdent_TmA [,statusIdent_Int], bRecalcStat
Parameters
archIdent in Reference to one of (historical) value, column or row of structured historical value (see Note).
timeFromIdent_TmA in Identifier of AbsTime type - beginning of the interval.
timeToIdent_TmA in Identifier of AbsTime type - end of the interval.
statusIdent_Int out Action success (optional parameter).
bRecalcStat in Identifier of Boolean type.
A calculation of dependent statistic archives. If the parameter is not set the dependent statistic archives will not be calculated.
Description The action will remove the data of the historical value archIdent within the time interval defined from timeFromIdent_TmA to timeToIdent_TmA. Naturally, the values of the parameters must be in the following relation: timeFromIdent_TmA <= timeToIdent_TmA (otherwise the error ERR_RANGE_ERROR is generated). The optional parameter statusIdent_Int represents the action success and may acquire one of the following values:
  • _ERR_TRANS_ABORT
  • _ERR_TRANS_ERROR
  • _ERR_TRANS_IGNORED
  • _ERR_NO_ERROR
If the parameter is not defined, the action generates a request to delete and script execution continues. There is no possibility to test the action success.

Deleted data has not got the attribute "deleted" (unlike deleting  D2000 HI - the attribute DELETED), but they are physically deleted from the archive database.
Note 1 The parameter archIdent:
  • not controlled whether the archive object is used - adding reference to object is enough,
  • can also contain the reference to a part (row or column) or an entire structured historical value.
Example:
  • H.ColArchiv - reference to entire structured historical value
  • H.ColArchiv[2] - reference to all values of structured historical value within the second row
  • H.ColArchiv^ColName - reference to all values of structured historical value within the ColName column
Note 2If parameter statusIdent_Int is set, DELETEARCHDATA is terminated as soon as all required values are deleted. Even if the parameter bRecalcStat is used and his value is @TRUE, the action does not wait on termination of recalculation of dependent statistic archives.
Example 1
 TIME _timeFrom
  TIME _timeTo
  INT _status

 _timeTo := %StrToTime("10:00:00 31-12-1999")
 _timeFrom := %StrToTime("09:00:00 31-12-1999")
 DELETEARCHDATA H.ArchObj, _timeFrom, _timeTo, _status

 IF _status = _ERR_NO_ERROR THEN
   ; data are deleted
 ELSE
   ; some error has occurred
 ENDIF 
Example 2
 TIME _timeFrom
  TIME _timeTo
  INT _status

 _timeTo := %StrToTime("10:00:00 31-12-1999")
 _timeFrom := %StrToTime("09:00:00 31-12-1999")
 
  ; deleting + calculation of dependent statistic archives - synchronously

 DELETEARCHDATA H.ArchObj, _timeFrom, _timeTo, _status, @TRUE

 IF _status = _ERR_NO_ERROR THEN
   ; data are deleted
 ELSE
   ; some error has occurred
 ENDIF
 
 ; deleting + calculation of dependent statistic archives - asynchronously
 
 DELETEARCHDATA H.ArchObj, _timeFrom, _timeTo,  @TRUE

Related pages:

Napíšte komentár