VAREVAL Function

Returns the value of a variable.

Category: String
Returned data type: String
Tip: The VAREVAL( ) function must look up field names each time it is called. Use the VAREVAL( ) function sparingly to avoid performance degradation.

Syntax

VAREVAL (string)

Required Argument

string

specifies a string that resolves to the name of a variable.

Details

You can use the VAREVAL function to help you dynamically select the value of different fields. First, write the code that creates the names of the fields that you want to access. Then, specify the field name in the VAREVAL function to access the value of that field. See the following example.

Example

Assume you have the following fields in your data: field_1, field_2, field_3, field_4 and field_5.
// Declare the string values for the function
string field_number
string field_value
// Declare a hidden integer as a counter
hidden integer n
// Loop trough all 5 variables in an input data source
for n=1 to 5
// Output the value in each of the fields field_1 through field_5
begin
     field_number='field_' & n
     field_value=vareval(field_number)
     pushrow()
end
// Return false to prevent the last row from showing up twice
return false