VarRecord GetFieldValue-type-() Method

Gets the value of a field in the calling record's variable field list.

Function Signature

 string GetFieldValueString( name )

int GetFieldValueInt( name )

int64_t GetFieldValueInt64( name )

double GetFieldValueDouble( name )

TimeT GetFieldValueTimeT( name )

Variant GetFieldValue( name )

Parameters

Parameter Type Description

name

string

The name of the field whose value will be retrieved from the calling record's variable field list.

Field names for variable fields should be provided in upper case for database names (TITLE, for example) or in lower/mixed-case for display names (Title, for example). For details on working with different types of database fields, refer to Working with SBM Database Fields.

Return

Type Description

string

int

int64_t

double

TimeT

Variant

The internal value for the field. For Text fields, this is the exact value entered in the field.

Technical Details

SBM ModScript version: 11.3. Signatures where return is not Variant were added in 11.4.

Example

//  Create and retrieve Contact record
var myRecord = Ext.CreateAppRecord (Ext.TableId ("TS_CONTACTS"));
var ok = myRecord.ReadWithWhere ("TS_CONTACTFIRSTNAME like 'Joe'");
//  If no e-mail address, supply default value
if ( ok ) {
    var value = myRecord.GetFieldValue ( "EMAIL" );
    if ( value == "" ) {
        ok = myRecord.SetFieldValue ( "EMAIL", "joe@company.com" );
    }
}
if ( !ok ) {
    Ext.LogErrorMsg ("Error in Joe's Email field");
}

Notes

Only use this version of GetFieldValue if you are sure that the field will be found.

Also see VarRecord GetFieldValue() Method.

Note: A GetFieldValue method is also included in the SBM JavaScript Library.

Related Topics

VarRecord