eyad alshareef 1 creating custom forms part a. 2eyad alshareef data block and custom forms data...

43
Eyad Alshareef 1 Creating Custom Creating Custom Forms Forms Part A Part A

Upload: verity-henderson

Post on 21-Dec-2015

218 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are

Eyad Alshareef 1

Creating Custom Creating Custom Forms Forms

Part APart A

Page 2: Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are

2Eyad Alshareef

Data Block and Custom Data Block and Custom FormsForms

Data block formData block form Based on data blocks that are Based on data blocks that are

associated with specific database tablesassociated with specific database tables Reflect the structure of the databaseReflect the structure of the database

Custom formCustom form Based on control blocks that process Based on control blocks that process

data from multiple tablesdata from multiple tables Reflect business processes rather than Reflect business processes rather than

the database structurethe database structure

Page 3: Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are

3Eyad Alshareef

Introduction to Custom Introduction to Custom FormsForms

Custom formCustom form Displays data fields from variety of Displays data fields from variety of

database tablesdatabase tables Contains programs that support Contains programs that support

organizational processesorganizational processes Use lists of values (LOVs) to retrieve Use lists of values (LOVs) to retrieve

data valuesdata values Manipulate data using form triggersManipulate data using form triggers

Page 4: Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are

4Eyad Alshareef

Identifying the Business Identifying the Business Processes and Database Processes and Database

OperationsOperations Identify processes that form Identify processes that form

supportssupports Identify associated database tablesIdentify associated database tables Describe processDescribe process

Page 5: Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are

5Eyad Alshareef

Designing the InterfaceDesigning the Interface

Visualize how form will lookVisualize how form will look

Page 6: Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are

6Eyad Alshareef

Creating a Custom FormCreating a Custom Form

Manually create form canvas in Manually create form canvas in Object NavigatorObject Navigator

Create form items by “painting” Create form items by “painting” items on canvasitems on canvas Using tools on Layout Editor tool Using tools on Layout Editor tool

palettepalette Write code that controls form Write code that controls form

functionsfunctions

Page 7: Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are

7Eyad Alshareef

Creating the Form Creating the Form CanvasCanvas

Manually create form canvas in Manually create form canvas in Object NavigatorObject Navigator

Start Forms BuilderStart Forms Builder Create and rename form canvasCreate and rename form canvas Rename form module and form windowRename form module and form window Change Title property of form windowChange Title property of form window

Perform in Visual View in Object Perform in Visual View in Object NavigatorNavigator

Page 8: Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are

8Eyad Alshareef

Creating a Control BlockCreating a Control Block

Control data blockControl data block Also called control blockAlso called control block Data block not associated with Data block not associated with

particular database tableparticular database table Create new data block in Object Create new data block in Object

NavigatorNavigator Specify data block created manuallySpecify data block created manually Use Ownership ViewUse Ownership View

Page 9: Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are

9Eyad Alshareef

Creating the Form ItemsCreating the Form Items

Create Create Boilerplate logo image and textBoilerplate logo image and text Form text items Form text items Command button itemsCommand button items

Display form in Layout EditorDisplay form in Layout Editor Draw items on form canvas using tools Draw items on form canvas using tools

in tool palettein tool palette

Page 10: Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are

10Eyad Alshareef

Creating the LOVsCreating the LOVs

LOVLOV Retrieve data from database tableRetrieve data from database table

Use LOV WizardUse LOV Wizard Run formRun form

To test LOVTo test LOV

Page 11: Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are

11Eyad Alshareef

Displaying System Date Displaying System Date and Time Values in Form and Time Values in Form

Text ItemsText Items System variable System variable

Variable representing value always Variable representing value always available to any formavailable to any form

Display value in text item Display value in text item automatically automatically Set text item’s Initial Value propertySet text item’s Initial Value property

Page 12: Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are

12Eyad Alshareef

Forms Builder Date and Forms Builder Date and Time System VariablesTime System Variables

CE
Slide title is figure caption, not heading - okay?
Page 13: Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are

13Eyad Alshareef

Creating Command Creating Command ButtonsButtons

Create and configure buttonsCreate and configure buttons Create form triggers associated with Create form triggers associated with

buttonsbuttons

Page 14: Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are

14Eyad Alshareef

Creating and Configuring Creating and Configuring Command ButtonsCommand Buttons

Draw button on canvas using Button Draw button on canvas using Button tool tool Button tool on tool paletteButton tool on tool palette

Button groupButton group Buttons should all be same sizeButtons should all be same size

Wide enough to accommodate longest Wide enough to accommodate longest button’s labelbutton’s label

Draw button with longest label firstDraw button with longest label first

Page 15: Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are

15Eyad Alshareef

Creating the Button Creating the Button TriggersTriggers

Select Triggers node under button in Select Triggers node under button in Object NavigatorObject Navigator Click Create button to create triggerClick Create button to create trigger Select trigger eventSelect trigger event Specify trigger codeSpecify trigger code

WHEN-BUTTON-PRESSED button WHEN-BUTTON-PRESSED button eventevent Trigger code executes when user clicks Trigger code executes when user clicks

buttonbutton

Page 16: Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are

16Eyad Alshareef

Creating the Button Creating the Button Triggers (continued)Triggers (continued)

Reference form items:Reference form items: ::block_nameblock_name..item_nameitem_name

Clear form text items in form trigger: Clear form text items in form trigger: Use CLEAR_FORM built-in procedureUse CLEAR_FORM built-in procedure Create program unit to set value of text Create program unit to set value of text

items to blank text stringitems to blank text string ProcedureProcedure

Code block that executes commands to Code block that executes commands to change one or more valueschange one or more values

Page 17: Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are

17Eyad Alshareef

Creating the Button Creating the Button Triggers (continued)Triggers (continued)

FunctionFunction Code block Code block Returns single valueReturns single value

Create program unit:Create program unit: Open Object Navigator Open Object Navigator Select Program Units nodeSelect Program Units node Click CreateClick Create buttonbutton

Program unit does not use Program unit does not use DECLAREDECLARE keywordkeyword

Page 18: Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are

18Eyad Alshareef

Creating a Custom FormCreating a Custom Form

1.1. Create the formCreate the form

2.2. Create the form window and canvas Create the form window and canvas manuallymanually

3.3. Create a control blockCreate a control block Data block that is not associated with a Data block that is not associated with a

specific tablespecific table Contains form items that you manually draw Contains form items that you manually draw

on the canvason the canvas

4.4. Create form triggers to process dataCreate form triggers to process data

Page 19: Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are

19Eyad Alshareef

Form TriggersForm Triggers

Code that is associated with a form Code that is associated with a form object and an eventobject and an event

Can contain SQL INSERT, UPDATE, Can contain SQL INSERT, UPDATE, DELETE, and SELECT commandsDELETE, and SELECT commands

Referencing form text item values in Referencing form text item values in triggers:triggers:

:block_name.item_name:block_name.item_name

Page 20: Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are

20Eyad Alshareef

Practice1Practice1

Create a custom form that has:Create a custom form that has: Employee NameEmployee Name Employee SalaryEmployee Salary Department NameDepartment Name

Create a LOV to retrieve block Create a LOV to retrieve block recordsrecords

Use triggers to retrieve block recordsUse triggers to retrieve block records Create a button that calls a program Create a button that calls a program

unit to clear the block.unit to clear the block.

Page 21: Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are

21Eyad Alshareef

Creating a custom formCreating a custom form Create a new form module and name it Create a new form module and name it

COURSECOURSE Click on data bloc and then on the plus Click on data bloc and then on the plus

icon. Select Build a data block manuallyicon. Select Build a data block manually Rename your block into COURSE_BLOCKRename your block into COURSE_BLOCK

Page 22: Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are

22Eyad Alshareef

Create and modify a Create and modify a canvascanvas Add a canvas by clicking on Canvas in Add a canvas by clicking on Canvas in

object navigator and then on a plus signobject navigator and then on a plus sign Rename your canvas into HEADER, and Rename your canvas into HEADER, and

open it with Design Editoropen it with Design Editor

Page 23: Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are

23Eyad Alshareef

Create and modify a Create and modify a canvascanvas

Change the background color of the Change the background color of the canvas using the Property palettecanvas using the Property palette

Add a header “Course Information”Add a header “Course Information” Add a picture (download any picture from Add a picture (download any picture from

the web, save in in C:\\temp, then go to the web, save in in C:\\temp, then go to Edit, Import)Edit, Import)

Page 24: Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are

24Eyad Alshareef

Add text boxes and Add text boxes and promptsprompts

Using the toolbox on the left, add Course Using the toolbox on the left, add Course Name text box and a corresponding Name text box and a corresponding prompt:prompt:

Page 25: Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are

25Eyad Alshareef

Add text boxes and Add text boxes and promptsprompts

Using the toolbox, add a stacked canvas on Using the toolbox, add a stacked canvas on COURSE canvasCOURSE canvas

Name your canvas COURSE_ITEMSName your canvas COURSE_ITEMS Add Room and Time text boxes and Add Room and Time text boxes and

corresponding prompts to the COURSE_ITEMS corresponding prompts to the COURSE_ITEMS canvascanvas

Page 26: Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are

26Eyad Alshareef

Add control buttonsAdd control buttons

Return to the main canvasReturn to the main canvas Using toolbox on the left, add four control Using toolbox on the left, add four control

buttons.buttons. Name them New, Find, Save and ClearName them New, Find, Save and Clear

Page 27: Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are

27Eyad Alshareef

Adding PL/SQL codeAdding PL/SQL code

Create triggers for each of the Create triggers for each of the buttonsbuttons

Add PL/SQL code to the triggersAdd PL/SQL code to the triggers

Page 28: Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are

28Eyad Alshareef

Adding PL/SQL codeAdding PL/SQL code

Page 29: Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are

29Eyad Alshareef

Adding PL/SQL codeAdding PL/SQL code

Create triggers for each of the Create triggers for each of the buttonsbuttons

Add PL/SQL code to the triggersAdd PL/SQL code to the triggers

Page 30: Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are

30Eyad Alshareef

Adding PL/SQL codeAdding PL/SQL code

Create triggers for each of the Create triggers for each of the buttonsbuttons

Add PL/SQL code to the triggersAdd PL/SQL code to the triggers

Page 31: Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are

31Eyad Alshareef

Adding PL/SQL codeAdding PL/SQL code

Create triggers for each of the Create triggers for each of the buttonsbuttons

Add PL/SQL code to the triggersAdd PL/SQL code to the triggers

Page 32: Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are

32Eyad Alshareef

Form Trigger PropertiesForm Trigger Properties

Trigger activatedTrigger activated In response to event such as clicking In response to event such as clicking

buttonbutton Trigger name defines event that Trigger name defines event that

activates itactivates it

Page 33: Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are

33Eyad Alshareef

Trigger CategoriesTrigger Categories

CE
Slide title is figure caption, not heading - okay?
Page 34: Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are

34Eyad Alshareef

Trigger TimingTrigger Timing

Specifies when trigger firesSpecifies when trigger fires PRE-PRE-

Fire just before event successfully Fire just before event successfully completescompletes

POST-POST- Fire just after event successfully Fire just after event successfully

completescompletes ON-,WHEN-, and KEY- ON-,WHEN-, and KEY-

Fire in response to actionsFire in response to actions

Page 35: Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are

35Eyad Alshareef

Trigger ScopeTrigger Scope

Defines where event must occur in Defines where event must occur in order for associated trigger to fireorder for associated trigger to fire

Includes object to which trigger Includes object to which trigger attachedattached And objects within trigger objectAnd objects within trigger object

Page 36: Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are

36Eyad Alshareef

Trigger Execution Trigger Execution HierarchyHierarchy

Defines which trigger fires Defines which trigger fires When object within form object contains When object within form object contains

same trigger that form object containssame trigger that form object contains By default trigger in higher-level By default trigger in higher-level

object overrides trigger in lower-object overrides trigger in lower-level objectlevel object

Can specify custom execution Can specify custom execution hierarchyhierarchy

Page 37: Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are

37Eyad Alshareef

Directing Form External Directing Form External NavigationNavigation

External navigation External navigation User causes form focus to change by User causes form focus to change by

making different form item activemaking different form item active Form focus Form focus

Item currently selected on formItem currently selected on form Internal navigation Internal navigation

Result of internal form code that Result of internal form code that responds to external navigation responds to external navigation operations or trigger commandsoperations or trigger commands

Page 38: Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are

38Eyad Alshareef

Setting the Form Tab Setting the Form Tab OrderOrder

Set tab order Set tab order Place items in correct order under Place items in correct order under

Items node Items node In Object Navigator windowIn Object Navigator window

Page 39: Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are

39Eyad Alshareef

Directing External Directing External Navigation Using Built-in Navigation Using Built-in

SubprogramsSubprograms Built-in subprogramsBuilt-in subprograms

Called built-insCalled built-ins Use to direct external form navigationUse to direct external form navigation

Cannot use in navigational triggersCannot use in navigational triggers

Page 40: Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are

40Eyad Alshareef

Built-in Subprograms to Built-in Subprograms to Control External Control External

NavigationNavigation

CE
Slide title is figure caption, not heading - okay?
Page 41: Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are

41Eyad Alshareef

User Action Triggers FiredResult on User Screen Display

User starts formPRE-FORMPRE-BLOCK

Form appears, but with no data visible

WHEN-NEW-FORM-INSTANCEWHEN-NEW-BLOCK-INSTANCEWHEN-NEW-RECORD-INSTANCEWHEN-NEW-ITEM-INSTANCE

Form is

available for use

Triggers That Fire at Form Startup

12 3

4 5

Page 42: Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are

42Eyad Alshareef

User Action Triggers Fired Result on User Screen Display

User places the insertion point in a text item

WHEN-NEW-ITEM-INSTANCE Insertion point appears in item

WHEN-NEW-RECORD-INSTANCE WHEN-NEW-ITEM-INSTANCE

Next record appears

User clicksthe Next Recordbutton

Triggers That Fire as a Result Of External Navigation

Page 43: Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are

43Eyad Alshareef

User Action Triggers FiredResult on User Screen Display

User closes the Forms Runtime window

Forms Runtime window closes

POST-BLOCKPOST-FORM

Triggers That Fire When a Form Closes