AppRecord GetFieldValue() Method

Gets the value of any field.

Function Signature

 bool GetFieldValue( name, string& value)

bool GetFieldValue( name, int& value)

bool GetFieldValue( name, int64_t& value) 

bool GetFieldValue( name, double& value) 

bool GetFieldValue( name, TimeT& value)

bool GetFieldValue( name, Variant& value)

Parameters

Parameter Type Description

name

string

The name of the field whose value will be retrieved from the variable field list or the AppRecord column. Field names for variable fields should be provided in uppercase characters for database names or in lowercase/mixed-case characters for display names (for Title, for example).

value

string&

int&

int64_t&

double&

TimeT&

Variant&

(Output) Returns the internal value for a field or column. For Text fields, this is the exact value entered in the field; for selection fields, the value is the database ID for the selection. For values that are not Variant or TimeT, this internally gets the value from the field as a Variant, and then tries to convert the value to the requested type.

TimeT can be used with Date/Time fields to get the internal date value.

Note: If the field is a Multi-User field for which the Groups and Users selection mode is enabled, the value can include both pure integers (TS_IDs from the TS_USERS table) and group identifiers (TS_IDs from the TS_GROUPS table). The latter are in the form G1, G2, …

Return

Type Description

bool

Returns true if the named field was found successfully; false otherwise.

Technical Details

SBM ModScript version: 11.3.

Example

//Create and retrieve Project record
var tableId = Ext.TableId("TS_PROJECTS");
var myRecord = Ext.CreateAppRecord(tableId);
var ok = myRecord.Read("Image Builder");
var value = 0; // initializes value as integer
if ( ok ) {
	 ok = myRecord.GetFieldValue( "parentid", value ); 
}
if ( ok ) {
	Ext.LogInfoMsg ("Parent ID of Image Builder is " &&& value);
} 
else {
	Ext.LogErrorMsg( "Unable to get Parent ID of " +
 "Image Builder project" );
}

Notes

Also see AppRecord GetFieldValue-type-() Method.

If the calling AppRecord is an item from a Primary or Auxiliary table, its variable field list is searched. Otherwise, the schema for its table is searched.

Related Topics

AppRecord