
Section 4. CRBasic – Native Language Programming
4.3 Program Access to Data Tables
Data stored in a table can be accessed from within the program. The format
used is:
Tablename.Fieldname_PRC( index,recordsback)
Where
Tablename The name of the table in which the desired value is stored. The
table can be a user defined table or the Status table.
Fieldname The name of the field in the table and is always an array even if
it consists of only one variable.
_PRC Abbreviation for the field processing used in the storage
process. For example, PRC = AVG when the Average data
processing instruction is used. Do not use an _PRC for Sample
processing, or for retrieving data from the Status Table. See
Table 4.3-1 for a list of these abbreviations.
Index Specifies the array element from which to retrieve the data and
must always be specified. Use 1 if the FieldName is a single
element array.
Recordsback The number of records back in the data table from the current
time (1 is the most recent record stored, 2 is the record stored
prior to the most recent) to retrieve. A negative number can be
entered for the RecordsBack parameter to specify the time, in
seconds since 1990.
A use example for this syntax would be to calculate the change in an average
output between two records. For Example Program 4.2.10-2, to find the change
in the 100 millisecond average between the most recent average and the average
that was stored 101 records earlier for TC(1), you could insert following code
into the program:
Tdiff=Table1.TC_Avg(1,1)–Table1.TC_Avg(1,101)
TABLE 4.3-1 Output Processing Abbreviations
PRC
Abbreviation
Output
Processing Name
PRC
Abbreviation
Output
Processing Name
Avg Average
MMT Moment
Cov Covariance
RFH RainFlow Histogram
Etsz ET
Rso Solar Radiation
FFT FFT
None required Sample
H4D Histogram4D
SMM Sample at Max or Min
Hst Histogram
Std Standard Deviation
LCr Level Crossing
TMx Time of Max
Max Maximum
TMn Time of Min
Med Median
Tot Totalize
Min Minimum
WVc WindVector
If a time of minimum or maximum is returned by Tablename.Fieldname, the
time is reflected in seconds since 1990. However, if FieldNameIndex is entered
as a negative value, then time is reflected in usec since 1990. This time value
can be converted to a standard datalogger timestamp if the variable is declared
as a Long and is Sampled into a table using the NSEC data format.
4-39
Komentáře k této Příručce