SBM AppScript Reference → Programming SBM AppScript → Application Objects → Object Types → Field
A Field object represents a variable field, from a primary or auxiliary item. Field objects are typically retrieved using the VarRecord method GetFieldValue() or the VarFieldList method FindField(). Field methods allow you to read and write the field's value and control whether it will be processed when the item is updated in the database.
AppRecord->Field
AppendJournalText (String): If the field is a Journal Text field, the parameter is appended as a new journal entry. Otherwise, nothing happens. You create a Journal Text field in SBM Composer by selecting a field type of Text and a display style of Journal. Journal Text fields have a type code of 101 (Text) and an attribute value of 2 (Journal) or 3 (read-only Journal).
Input text (String) – The text to append as a journal entry.
Output: N/A
Return: (Boolean) – True if this field is a Journal Text field (and hence the text was appended); false if not.
GetDbValue(val): Get the field's internal value as it is currently stored in the database. This value does not reflect any changes that are waiting to be stored, such as editing that has occurred on a transition form. When an Update() executes, this value is recorded in the change history as the "prior" value. To get the current value reflecting all changes, use the GetValue() method.
Input: N/A
Output: val (String) – The internal database ID for the value. For Text fields, this is the exact value entered in the field.
Return: N/A (this method is a subroutine, not a function)
GetDisplayValue( val, checkPrivs ): Get the current value of this field, reflecting any changes that may have been made since the last database Update(). Note that this is the display value as shown on the browser, and not the internal value stored in the database. For example, for a selection field, the value of the selection (None) is 0 in the database. This function will return the string (None), while GetValue and GetDbValue will return 0. To get the value most recently stored in the database, use the method GetDbValue(). If this field comes from an item that was directly read out of the database and you wish to use checkPrivs, you must call the ApplyProjectStateOverrides() VarFieldList method.
Input: checkPrivs (Boolean) – Optional, defaults to True if omitted. If True, the value will only be supplied if the current user has sufficient privileges to see this field.
Output: val (String) – This field's current value as a formatted string.
Return: N/A (this method is a subroutine, not a function).
GetSelectionList(): If this field is a selection list field (single or multiple), this method will return a list of all possible selection values.
Input: N/A
Output: N/A
Return: (AppRecordList object) – All possible selections, as AppRecord objects from the TS_SELECTIONS table.
GetType(): Returns a code identifying the type of data stored in this field.
Input: N/A
Output: N/A
Return: (Long Integer) – A code identifying the type of data stored in this field.
GetTypeString(): Returns a string identifying the type of data stored in this field. For example, if GetType returned 114 then GetTypeString may return "Product selection field".
Input: N/A
Output: N/A
Return: (String) – A string identifying the type of data stored in this field.
GetValue(val): Get the field's internal value without checking privileges, including changes made to the value during the transition if in a transition context.
Input: N/A
Output: val (String) – The internal database ID for the value. For Text fields, this is the exact value entered in the field.
Return: N/A (this method is a subroutine, not a function)
IsAuto(): Determine whether this field is set to be automatically populated.
Input: N/A
Output: N/A
Return: (Boolean) – True if this field is automatically populated; false if not.
IsBlank(): Determine whether this field does not contain data. This typically occurs when a field is uninitialized, meaning it has never had a default value or values entered by users.
Input: N/A
Output: N/A
Return: (Boolean) – True if this field contains data; false if not.
IsDbBlank(): Determine whether this field does not contain data stored in the database. This typically occurs when a field is uninitialized, meaning it has never had a default value or values entered by users.
Input: N/A
Output: N/A
Return: (Boolean) – True if this field contains data; false if not.
IsSelected(): Determine whether this field has been selected for Update() processing by the Select() method. If not selected, the field will be ignored during the next database update. See the Select() method for more details.
Input: N/A
Output: N/A
Return: (Boolean) – True if selected; false if not.
Select(selectFlag): Set or clear this field's select flag, to control processing during the next Update(). When an item is updated in the database, all of its selected fields are checked for changes. Only fields that have changed are updated in the database. Since checking all fields can be an expensive operation, some fields can be deselected if it is already known they have not changed -- then, they will not even be processed. Note that the select flag can be overridden by the VarFieldList method SelectAll().
Input: selectFlag (Boolean) – If True, this field will be processed during the next Update(). If False, it will be skipped unless overridden by the VarFieldList method SelectAll().
Output: N/A
Return: N/A (this method is a subroutine, not a function)
SetBlankValue(): Removes data from this field, returning it to an uninitialized state. The field then contains a special code representing a lack of data, which can be detected by IsBlank().
Input: N/A
Output: N/A
Return: N/A (this method is a subroutine, not a function)
SetValue(val): Set or change this field's value to the internal value supplied.
Input: val (String) – The internal value for the field. For Text fields, this is the exact value entered in the field.
Return: N/A (this method is a subroutine, not a function)
Copyright © 2007–2015 Serena Software, Inc. All rights reserved.