INSERTARCHARR action


Function
Modification, or writing the value array into the archive.
Declaration
INSERTARCHARR archIdent, locVarColValueIdent_Rec [,[retIdent_Int], bRecalcStat_Bool]

Parameters
archIdent in Reference to one of (historical) value - (not controlled whether the archive object is used - adding reference to object is enough).
locVarColValueIdent_Rec in Column identifier of a Record type local variable.
retIdent_Int out Identifier of Int type - return code: action success (optional parameter).
bRecalcStat_Bool in Identifier of Bool type - enables/disables calculation of related statistical historical values (optional parameter).

Description
The action  writes the value array for the archive object archIdent. Value array represents the column, to which the parameter locVarColValueIdent_Rec refers. Time of writing the values into the archive is defined by the time of their generation. If the parameter retIdent_Int is not stated, the action does not wait for confirming the writing. If the identifier is stated, it gets one of the following values:
  • _ERR_TRANS_ABORT
  • _ERR_TRANS_ERROR
  • _ERR_TRANS_IGNORED
  • _ERR_NO_ERROR

Note
If the identifier retIdent_Int is not stated, the script has no feedback to detect the action success. Action execution time is short, because it is a request, that is sent to the system.

If the identifier retIdent_Int is stated, the script waits for the physical writing of the value into the archive database.

Result:
If I will use the action to write a value into the archive without waiting and then I will read the value, the read value almost certainly will not be that one written in the previous action.

Calculation of related statistical historical values can be disabled by setting the parameter bRecalcStat_Bool to the value of @FALSE.


Example
Writing the value into the archive:

 
 RECORD (SD.ArchDemo) _data
 INT  _value
 INT  _idx
 TIME _bt
 INT  _retCode
 
 _bt := %StrToTime("8:01:00 16-10-2003")
 REDIM _data[60]
 
 ; assign any data
 _idx := 1
 _value := 100
 DO_LOOP
   EXIT_LOOP _idx > _data\DIM
 
   _data[_idx]^value := _value TIME _bt
   _idx := _idx + 1
   _value := _value + 1
   _bt := %AddTime(_bt, 1)
 END_LOOP
 
; writing
 INSERTARCHARR H.ArchObj, _data^value, _retCode
 
; action success test
 IF _retCode # _ERR_NO_ERROR THEN
 ; write error
 ENDIF


Related pages:

0 komentárov

Nie ste prihlásený. Akékoľvek zmeny, ktoré vykonáte, sa označia ako anonymné. Ak už máte svoj účet, pravdepodobne sa budete chcieť prihlásiť .