Adding Computations, Processes, and Validations - Creating Computations (Page 4 of 4 )
Computations are created in two places. Application-level computations are created from the Application Computations link in the Logic section of the application’s shared components. When creating an application-level computation, you are taken directly to the Edit Application Computation page. Page-level computations are created from the Add icon in either the Computation section at the bottom of the Page Rendering column or the Computation section at the top of the Page Processing column. Both of these will start the computation-creation wizard. This wizard can also be started through the Create link on the Developer’s Toolbar and selecting the Page Control on This Page option.
The first step in the process is to select whether you want to calculate the value for an item on the same page, an item on another page, or an application-level item. Next, you select the item on which you want to create the computation from a pick list based on your first selection. You also specify the sequence for the computation. If there are multiple computations at the same processing point, they will be processed in the order of the sequence number. You also specify the computation point and the type of computation.
The six different types of computations offer the developer great flexibility in how the value of an item may be determined. Each type, along with an example, is shown in the following table.
Computation Type | Example |
Static Assignment | 5 or completed |
PL/SQL Function Body | This is a simple example but it can be as complex as any function you would otherwise write including a declaration section. if instr(upper(:p5_lastname),'DAN')>0 then return :p5_notes||' it''s a Dan'; else return :p5_notes; end if; |
SQL Query | select code_value from code_table where code = :p45_user_value; |
SQL Expression | substr(:p5_name, instr(:p5_name, ',') + 1 ) |
PL/SQL Expression | nvl(:p5_country, ‘Unknown’) |
Item Value | p5_other_field |
The last step in the wizard allows you to specify a condition that must be met before the computation will be executed. All the normal 60-plus condition types are available.
Editing Computations To edit a page-level computation, click on the name of the computation to navigate to the Edit Page Computation page. In addition to the attributes entered in the wizard, you can specify an error message in case the computation fails. Additionally, the normal sections for Authentication, Configuration, and Comments are available.
When you click on the title of the Computations section, you will navigate to the Page Computations page, where you can edit the sequence and computation point of all your computations. You can also see the computation type, whether it is conditional, and when it was last updated.
To edit application-level computations, navigate to the specific computation through the Application Computations link in the Logic section of the application’s shared components.
Please check back next week for the continuation of this article.
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |
|
This article is excerpted from chapter 13 of the Oracle HTML DB Handbook, written by Lawrence Linnemeyer and Bradley Brown (McGraw-Hill, 2006; ISBN: 0072257687). Check it out today at your favorite bookstore. Buy this book now.
|
|