Using PL
-
Upload
nicoleta-bordeianu -
Category
Documents
-
view
219 -
download
0
Transcript of Using PL
-
7/28/2019 Using PL
1/2
Using PL/SQL Code to ActivateNavigation Buttons
The next series of steps is to make the navigation buttons on the Wiz_bar canvaswork. This requires a When-Button-Pressed trigger for each button. The buttons
will use the Wizard library procedures to perform the needed functionality. Exhibit
2.7 illustrates the PL/SQL for the Cancel button. This code block first clears thewizard of any data, without committing it. The Wizard_finish package procedure
hides (i.e., closes) the Wizard window. However, the developer must navigate to an
appropriate item or the current page will redisplay. The Exit_form subprogramperforms this function. If you want to return to a different canvas within the form,
use the Go_item or Go_block built-ins.
Create a When-Button-Pressed trigger for the Cancel button using the
code block in Exhibit 2.7.
Exhibit 2.7: PL/SQL Code for the Cancel Button When-Button-Pressed Trigger
-- This removes the Wizard Window.clear_form (no_commit);Wizard.Wizard_Finish;exit_form;
-- If you would like to display a base canvas rather than leaving-- the form, use a go_item or go_block subprogram rather than-- the exit_formEnd Listing
Exhibit 2.8 illustrates the PL/SQL code block used in the Back button's trigger. This
trigger navigates to the previous wizard page. It uses the Wizard.Page_numberpackage variable to compute the previous page number. It also has provisions to
prevent the user from navigating to the Welcome page. The user will hear a bell
alarm and will see a message if this navigation is attempted.
You should notice that the actual navigation between pages is with the Go_itembuilt-in. The Wizard procedures do not perform navigation. Navigation within thewizard is done in the tradition Forms manner.
Create a When-Button-Pressed trigger for the Back button using the codeblock in Exhibit 2.8.
Exhibit 2.8: PL/SQL Code for the Back Button When-Button-Pressed Trigger
declare-- Computes the number of the previous wizard page
next_page number default Wizard.Page_Number-1;begin-- Navigate to the appropriate page
if next_page = 1 then-- The following two lines prevent the user from navigating to the
Welcome Page.bell;message (You are on the first Employee Entry page');
elseif next_page = 2 then
go_item(EMPLOYEE.PAYROLL_NUMBER');elsif next_page = 3 then
go_item(EMPLOYEE.SOCIAL_SECURITY_NUMBER');elsif next_page = 4 then
go_item(EMP_TOOLS.PURCHASE_DATE');end if;-- Set the page number to previous page and display itWizard.Wizard_Show(next_page);-- The name of the new canvas is in package variable-- Wizard.PageName
-
7/28/2019 Using PL
2/2
end if;end;
Exhibit 2.9: PL/SQL Code Block for the Next Button's When-Button-Pressed Trigger
declarenext_page number default Wizard.Page_Number+1;
begin--Navigate to the appropriate pageif next_page = 2 then
go_item(EMPLOYEE.PAYROLL_NUMBER');-- Set the page number to previous page and display itWizard.Wizard_Show(next_page);-- The name of the new canvas is in package variable-- Wizard.PageName
elsif next_page = 3 thengo_item(EMPLOYEE.SOCIAL_SECURITY_NUMBER');Wizard.Wizard_Show(next_page);
elsif next_page = 4 thengo_item(EMP_TOOLS.PURCHASE_DATE');Wizard.Wizard_Show(next_page);
elsif next_page = 5 thengo_item(employee.holder');Wizard.Wizard_Show(next_page);
else
bell;message(You are on the last page of the Wizard');end if;
end;