04.01.2015 Views

CR1000 Manual - Campbell Scientific

CR1000 Manual - Campbell Scientific

CR1000 Manual - Campbell Scientific

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Section 7. Installation<br />

'Program<br />

BeginProg<br />

Scan(1,Sec,0,0)<br />

'Assign strings to String variables<br />

Wrd(1) = " ":Wrd(2) = "Good":Wrd(3) = "morning":Wrd(4) = "Don't"<br />

Wrd(5) = "do":Wrd(6) = "that":Wrd(7) = ",":Wrd(8) = "Dave"<br />

'Assign integers to Long variables<br />

PhraseNum(1) = 1:PhraseNum(2) = 2<br />

'Concatenate string "1 Good morning, Dave"<br />

Phrase(1) = PhraseNum(1)+Wrd(1)&Wrd(2)&Wrd(1)&Wrd(3)&Wrd(7)&Wrd(1)&Wrd(8)<br />

'Concatenate string "2 Don't do that, Dave"<br />

Phrase(2) = PhraseNum(2)+Wrd(1)&Wrd(4)&Wrd(1)&Wrd(5)&Wrd(1)&Wrd(6)&Wrd(7)&Wrd(1)&Wrd(8)<br />

CallTable Test<br />

NextScan<br />

EndProg<br />

7.7.3.10 Program Access to Data Tables<br />

A data table is a memory location wherein data records are stored. Sometimes,<br />

the stored data needs to be used in the CRBasic program. For example, a program<br />

can be written to retrieve the average temperature of the last five days for further<br />

processing. CRBasic has syntax provisions facilitating access to these table data,<br />

or to meta data relating to the data table. Except when using the GetRecord()<br />

instruction (Data Table Access and Management (p. 517) ), the syntax is entered<br />

directly into the CRBasic program through a variable name. The general form is:<br />

Where:<br />

TableName.FieldName_Prc(Fieldname Index, Records Back)<br />

• TableName is the name of the data table.<br />

• FieldName is the name of the variable from which the processed value is<br />

derived.<br />

• Prc is the abbreviation of the name of the data process used. See table<br />

Abbreviations of Names of Data Processes (p. 148) for a complete list of these<br />

abbreviations. This is not needed for values from Status or Public tables.<br />

• Fieldname Index is the array element number in fields that are arrays<br />

(optional).<br />

• Records Back is how far back into the table to go to get the value (optional).<br />

If left blank, the most recent record is acquired.<br />

Table 21. Abbreviations of Names of Data<br />

Processes<br />

Abbreviation<br />

Tot<br />

Avg<br />

Process Name<br />

Totalize<br />

Average<br />

148

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!