Databases Reference
In-Depth Information
By default, these validations are only executed for new or changed rows. You can change this behavior by
setting the execution scope of the validation, located in the Conditions section.
Note
The Create Validation wizard also allows the creation of row-level validations on tabular forms. These validations
are run once for each row being processed by the tabular form. At this level, you could easily create a validation,
similar to the one created for page 210, that checked to see if the Closed On date was after the Created On date.
As an exercise to see how much you've learned, see if you can implement that validation at the row level of the
tabular form on page 230.
Computations
The APEX computation is analogous to a PL/SQL function. The intent is to act on an item in the application by setting
the value using a variety of methods. This allows information to be derived rather than just stored in the data tables.
Computations can be implemented when a page is rendered or after a page is submitted back to the server, depending
on the needs of the application. Computations can act on any item available within an application. Items that can be
set include items on the current page, items on another page, and even application-level items.
There is also a type of computation that can be used at the application level. It's available in an application's
shared components. This type of computation has additional options for execution points including a computation
point called On New Instance that executes when a new session (or instance) is given to a user when they log in.
Execution
It's important to understand when a computation is executed relative to when a value is shown on a page and to when
other values are available to the computation. When using the value of an item in a computation, the current session
state for that item is the value that is used. A computation sets an item value in session state, and any processing
(computations, validations, or processes) that uses that item after it has been set sees the results of that computation.
When a page is rendered, it shows what is in the session state for that item at the time it's shown on the page. The
computation point is the setting that determines when the computation is executed.
On the page definition screen, several computation points are shown in the page tree. You can adjust the
computation point by clicking and dragging the computation in the tree to a different computation point, or by editing
the computation and changing the values for the sequence and computation point directly. The sequence only orders
the computations within a given computation point. In general, the page renders and processes as shown on the page
definition screen, starting at the top and going down the list to the bottom. There are only minor exceptions, such as
dynamic actions and AJAX callbacks, which have variable points of execution.
Types
Computations have much of the same flexibility as other APEX components. They can be complex or simple, with the
full capabilities of the Oracle Database to support them. The types of computations are as follows:
Static Assignment : Simple static text value
PL/SQL Function Body : PL/SQL function syntax with a RETURN statement
SQL Query (Return Single Value) : Any SQL statement as long as it returns a single row and
a single column
SQL Query (Return Colon Separated Values) : SQL used for multiselect items
 
 
Search WWH ::




Custom Search