DBValue

(Engine-Level Function)

Maintained only to provide backward compatibility with legacy applications. Do not use in new code.

Description: Returns a certain value retrieved from a VTScada database.
Returns: Numeric
Usage: Script or steady state.
Function Groups: Database and Data Source
Related to: DBAdd | DBInsert | DBListGet | DBListSize | DBRemove | DBSystem | DBTransaction | DBValue
Format: DBValue(DBSysVal, IDKey, FieldNumber[, ListNum])
Parameters:  
DBSysVal
Required. The database value to use. This is the return value from a DBSystem call.
IDKey  
Required. Any text expression that designates the record to use. It can contain the wildcard characters "*" and "?".
FieldNumber   
Required. Any numeric expression that indicates the field for which data is requested. Valid values for FieldNumber are as follows

Value 

Meaning

-1A timestamp is required. A ListNum parameter must be supplied, specifying which list the timestamp is to be retrieved from.

Event code for the record

1 to 255

 Indicates which piece of the record's data you wish to retrieve.

ListNum

Optional numeric. When FieldNumber is -1, specifying that a timestamp is required, then that timestamp will be taken from the numbered list in the DB system matching this parameter. The numbered lists start at zero.
See: DBSystem for related information.

Comments: Unlike most of the other database statements, this function is not threaded. Execution of all other statements will wait until this statement has completed execution and returned its result.
If no records matching IDKey are found, the return value will be Invalid.
If the database file has its read-only attribute set when this function is executed, it will be cleared automatically by execution of the function.

Example:

  MyDB = DBSystem(DbFile, "", 0, 0, 16 { key }, 2 { field 1 }, 3 { field 2 }); 
  If Valid(DBValue(MyDB { Database to use },
           "Motor_67" { ID key }, 
           1 { Field to get value from }) Next;
  [
    ... 
  ]