Setting, Getting, and Displaying Values and Variables

Previous Next

See Also

When including scripts in the generated web pages, a typical task is to get or set the values of the various fields, and the underlying data source items (either columns or variables):

For variables only, once you have defined a variable set containing one or more variables, you can use these variables to store temporary values and to display or read them.

Then, for all data source items (columns AND variables):

· To set and display the value of a data source item interactively in a field, you can add a column control to a page. The data source item then automatically synchronizes with the field value.

 

· To set or get the value of a data source item from a script, you can add a script to an object with a callClientScript action.

See: Scripting, and its related topics.

There are four predefined JavaScript functions that you can use:

setValue(<DataSource name>,<DataSource item>, <value>)

setSearchValue(<DataSource name>,<DataSource item>, <value>)

and

getValue(<DataSource name>,<DataSource item>)

getSearchValue(<DataSource name>,<DataSource item>)

These functions are defined in the interface.js JavaScript file that you can find in the js subfolder of any publication folder.

For an example, see: Scripting Example: The Period Case.

· To set the value of a data source item to a hard-coded value, you can also use the setValue or setSearchValue action, instead of using JavaScript.

See: Events and Actions, and its related topics.

· To use the value of a data source item in a SQL statement, see: Placeholders in SQL Statements.