Topics: Hands-On 09: Trigger (PRE-QUERY), set dynamically
properties
On the "Orders" tab
canvas layout, include two radio buttons to allow the user to manipulate the
order of displayed records by order date.
You have been
assigned to create two radio buttons, Labeled "Ascending" and
"Descending" to
sort displayed record order by "order date."
In this Hands-On,
you will learn how to: create and use pre-query trigger, set dynamically block
property on a table's data block and execute the query using trigger.
|
More Resources by
Google: |
|
|
|
|
Save the Form name
as version 9.
Open the “Orders”
Tap Page canvas.
Create the radio
button triggers to sort the block by the order date.
Select the "Data
Blocks" item and create a new data block manually.
Open its property
palette.
Change "name" to a
more meaningful naming convention. And press the enter key.
Change "Database
Data Block" to "no."
Close the window.
On the “BLOCK” box,
select the sort_block item.
Create a radio
button.
Click “new” to
create a new “Radio Group” for sorting.
Notice on the
"object navigator," a radio group and radio button were created.
Open the “Radio
Group” property palette.
Change the "name"
property to a more meaningful naming convention and then press the enter key.
Change "initial
Value" to "orderdate asc." Then press the enter key and click “OK.”
Change "Database
Item" to "no."
Close the window.
Open the “Radio
Button” property palette.
Change the "name"
property to a more meaningful naming convention.
Change "radio
button value" to "orderdate ascending."
--
You can also change
some other properties.
Change "Label" to
"Ascending."
Close the window.
Right click to open
property palette or
copy and paste the
Radio Button item.
Place it in the
“sort_select” Radio Group.
Click “OK.”
Move the new "radio
button" item.
Open its property.
Change the "name."
Change the "label."
Change "radio
button value" to "orderdate desc."
Then close the
window.
Click on the "Text"
icon; and type 'sort order date.' Then click outside of the text box.
Change the
appearance of the text.
Create a
"WHEN-RADIO-CHANGED" trigger. Type “W” then “R.” And select the trigger.
Write a PL/SQL
procedure to go to the order block and then execute the query statement.
Compile the trigger
and close the window.
Create a
"PRE-QUERY" trigger for the “order” data blocks.
Write a PL/SQL
procedure to change the “order_by” property of the “order” data block.
Notice that the
“sort_select” value is changed based on the radio button you select.
Compile the
trigger.
Close the window.
Run the
application.
Click “Execute
query.”
Navigate through
the application and check the sort radio button.
After the testing
is done, close the window and save the changes
Now, you should
practice this over and over, until you become a master at it.
Good Luck.
|