View Source

Several methods exist in the Historic aggregate class for importing data into point and accumulator histories.

h4. LoadDataValue

{code}
LoadDataValue( Value{Variant},
Timestamp{Time},
Quality{Long},
Reason{Byte} )
{code}

Values for *Quality* parameter (ClearSCADA uses standard [OPC HDA quality|OPC Quality Flags] definitions), e.g.:
* 0 = Bad
* 64 = Uncertain
* 192 = Good

Values for *Reason* parameter (Reason For Logging field available in the historic database):
* 0 = Current Data
* 1 = Value Change
* 2 = State Change
* 3 = Timed Report
* 4 = End of Period
* 5 = End of Period Reset
* 6 = Override
* 7 = Release Override
* 8 = Modified/Inserted

h4. LoadDataValues

{code}
LoadDataValues( Value{Array of Variant},
Timestamp{Array of Time},
Quality{Array of Long},
Reason{Array of Byte} )
{code}

Same as *LoadDataValue* except the parameters passed in are arrays instead of single values. A maximum of 5,165 elements are allowed in the arrays otherwise an error will be raised.
The *Reason* argument is optional - when omitted defaults to 0 (Current Data).

h4. LoadDataValuesEx

{code}
LoadDataValuesEx( Value{Array of Variant},
Timestamp{Array of Time},
Quality{Array of Long},
Status{Array of Long},
State{Array of Byte},
Reason{Array of Byte},
MSState{Array of Byte} )
{code}

Extended version of *LoadDataValues* that allows all of the properties of the historic data record to be specified.
The *Status*, *State*, *Reason* and *MSState* paramaters are all optional.
The *Status* parameter is a bit mask of flags that varies between drivers.
To calculate the *State* from the *Value* specify the state as 255 (or omit the parameter).
If there is no master-station state (or feature is disabled) then specifiy the *MSState* as 255 (or omit the parameter).

h4. LoadSuppressionValues

{code}
LoadSuppressionValues( Type{Array of Short},
Timestamp{Array of Time} )
{code}

Values for *Type* parameter (consequential alarm type):
* 0 = None
* 1 = Consequential
* 2 = Maintenance

h4. LoadDataFile

{code}
LoadDataFile( FileName{String} )
{code}

The LoadDataFile method takes a filename as its single parameter. This is the name of a local CSV on the *main server*. Some points to note about the files to be imported:
* Each line of the CSV file specifies a single record and has the format: YYYY,MM,DD,HH,MM,SS,Value
* The file must be in ANSI format.
* To insert comments into the file start the line with a semi-colon.
* *Reason* is set to 0 (Current Data) on import.

h4. Performance

*LoadDataFile* is much faster at importing records than *LoadDataValues*.