MoneyWorks Manual
GetFieldValue (windowRef, fieldNumOrName [, boolPeriodDecode])
Result Type: text
Definition: Gets the value of a field as a string. Works with check boxes and popups as well.
The field can be identified by number or its symbolic name. Using the symbolic name is very strongly recommended because it is possible for field numbers to change between versions of MoneyWorks. The only reason to use the field number is if you are iterating over all the fields in a window (possibly to find out what their symbolic IDs are).
For a popup control, the result is the text of the selected item. For a radio button or checkbox control, the result will be "1" if the control is set, otherwise "0".
Example:
TextToDate(GetFieldValue(win, "E_DATE"))
gets the transaction date from the transaction window referred to by win
.
Notes:
You can use a field number of -1 to get the window title.
For a record entry window, you can use a field number of -2 to get the sequence number of the record being modified in the window ("0" will be returned if it is a new record, as the sequence number has not yet been allocated). Note that the return value is a string containing the sequence number in decimal.
In MoneyWorks Gold 8.1.5 and later, you can use a field number of -3 in a record entry window to get the locked state of the record being modified in the window (if the window is read-only due to another user having the record locked, this will return "1", otherwise "0").
In MoneyWorks 9.0.8 and later, you can pass TRUE as a third parameter to decode a period menu to the period number instead of retrieving the text of the selected item.
Availability: available within MWScript handlers.