SBM JavaScript Library Guide → Reference → Field Methods → GetFieldValue
Gets the value of the specified field.
Name | Type | Description |
---|---|---|
fieldName | String | The name of the field. |
defaultValue (optional) | String | The default value to return if the field does not exist on the form, if it is not found, or if its value is empty. If this parameter is not provided, "null" is returned. |
path (optional) | String | The name of the sub-field to return. On some field types, a path of “ID” will return a unique internal identification number. |
Field Type | Field Style | Return Value |
---|---|---|
Binary/Trinary | Drop down list, Radio buttons | String value of the field. |
Binary/Trinary | Check box | Numeric value 1 if checked; empty value if cleared. (It is recommended that you use IsFieldChecked instead for this field type and style.) |
Date/Time | Date and time, Date only, Time of day | A Date object containing the value of the field. |
Date/Time | Elapsed time | Numeric value for the number of milliseconds of elapsed time. |
Folder | N/A | String value of the field |
Multi-Group, Multi-User, Multi-Selection, Multi-Relational | N/A | String value of the field. If multiple values are selected, a comma-separated list is returned. If the values have embedded commas, use GetFieldValues instead to retrieve the array. |
Grid | Embedded Report, Relational Grid | String value of the field. If multiple values are selected, a comma-separated list is returned. A path parameter is required to specify the column to retrieve values from. |
Numeric | N/A | Numeric value of the field. |
User, Single Selection, Single Relational | N/A | String value of the field. |
Sub-Relational | N/A | Depends on the referenced field. |
Summation | N/A | Numeric value of the field. |
Text | N/A | String value of the field. |
This example returns the string value of the Unit Price field:
GetFieldValue("Unit Price");
This example returns the string value of a multi-relational field, or “none” if there is nothing to return:
GetFieldValue("MyMultiRelational", "none");
This example returns a comma separated list of IDs corresponding to selected rows on an embedded report, or an empty string if there is nothing to return:
GetFieldValue("MyEmbeddedReport", "", "IDs");
This example returns an array of string values corresponding to the Title sub-field of an embedded report’s selected rows, or “No items selected” if there is nothing to return:
GetFieldValue("MyEmbeddedReport", "No items selected", "Title[]");
(none)
Copyright © 2007–2015 Serena Software, Inc. All rights reserved.