Field()
Returns a specific field from a data row.
The Field()
function has three parameters:
row
(string): Required. The row object that contains the field that you want to return.fieldName
(string): Required. The name of the field to return from the row.boolExceptionIfNotFound
(boolean): Iftrue
, the function returns an exception if the specified field doesn’t exist. Iffalse
, the function returns an empty string if the field doesn’t exist. The default value istrue
.
To use the function, pass it a row and the name of the field from that row that you want to return. This example sets the value of @field
to the value of the field "FieldName" from the first row of the rowset contained in the @rowset variable.
You can combine the Field()
function with the Row()
function to output a specific piece of data from the specified row. This example creates a rowset from JSON data. The Row()
function retrieves the first row from the rowset. The Field()
function retrieves the value of the "Price" attribute from the first row.
The function outputs 100
.