Host Variable (HostVar) Functions

Previous Next

See Also

There are three HostVar functions available:


· setHostVar()
· setGenericHostVar()
· removeGenericHostVars()


These functions are described below.

The setHostVar() JavaScript function sets a temporary, one-time host variable to a literal value. This value can be used in a SQL query triggered by the next event fired after calling the setHostVar() function. This event can contain the ExecuteSQLStatement action, or any other action that queries data sources with host variable placeholders used in their SELECT or WHERE clause.

Additional parameters:

name: name of the host variable used in the SELECT or WHERE clauses of a data source.

value: a literal value that is substituted for this host variable.




Followed by an ExecuteSQLStatement action that performs this query:


Furthermore, if the placeholders are used in Output Expressions or the Where Clause definition of a data source, then for each query made on this data source, appropriate setHostVar() function calls must be included.

If the same host variable and value is required in multiple actions or events, use the setGenericHostVar() function instead. The host variables and its values are valid and included in every PageEngine call until removed with the removeGenericHostVars() function, or until you navigate to another page.