Computations
A computation is used to set the value of a
page item either during page rendering or during page
processing. There is also the ability to create Application
Computations to set page item values when a new session is
created during login. When creating computations, properties
are set to define what page item(s) will be set, when the
computation will be executed, and how it will be done.
-
Computation Location
-
Computation Point
-
Computation Type
-
Conditions
Computation
Locations
Computation locations identify where the
page item is located that will be set by the computation.
: This type of computation is used to set the
value of a single item on the current application page.
: This type of computation is useful when
navigating to another page and wanting to set page items on that
page. Using this method, the values can be hidden by not having
to send them in the URL. The limitation of using this method is
the page will not provide a URL for the user to save in the
browser as a Favorite. A common example would be saving a sale
item on the web site.
: This type of computation is used to set the
value of an item defined at the Application Level. Application
level items act as global items. A benefit of using an
application level item is when the page cache is cleared, the
application level items are not cleared. A disadvantage of
using application level items as place holders for values is
another page may overwrite the value.
Computation
Points
A Computation Point defines when the logic
control will be considered in the order of execution. This
happens for both page rendering and page processing.
Application Level Computation Points
On New Instance
is an application level computation and should be created as
such. It can be a little confusing since this computation point
is available when creating a computation at the page level.
However, do not use the On New Instance display point on
application pages. These should be defined as an Application
Computation in Shared Components. When an On New Instance
computation is created at the application level, it will be
executed during login when the session is created in HTML DB. A
good use of this type of computation would be to read a cookie
from the user’s browser to set some application level items.
Page Rendering Computations
The computation points covered in this
section are executed during page rendering. This may be
confusing when first starting to build web applications using
HTML DB, but this chapter will show how they are used and reveal
their inherent value.
-
Before
Header
-
After Header
-
Before Region(s)
-
After Region(s)
-
Before Footer
-
After Footer
The explanation of these execution points
will be delayed until the section on Computation and Processing
Points in Detail is covered in this chapter. There, a thorough
explanation of the execution points during page rendering will
be presented.
Page Processing Computations
The final computation point is After
Submit. An After Submit Computation Point is considered for
execution during Page Processing.
An After Submit computation would be used to
calculate a person’s age based on a birth date page item, to
calculate the number of days between two dates, or to set a page
item with the total amount from a list of numbers. As mentioned
earlier, it could also be used to set values on another page so
as to not pass the values in the URL.