• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Oracle Apps-- D2K notes

Oracle Apps-- D2K notes



Oracle Apps-- D2K notes

Oracle Apps-- D2K notes



Total Views
Views on SlideShare
Embed Views



0 Embeds 0

No embeds



Upload Details

Uploaded via as Microsoft Word

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

    Oracle Apps-- D2K notes Oracle Apps-- D2K notes Document Transcript

    • 6i
    • What is D2K? It is front tool. First name of D2K Oracle * Form Developer 2000-5.0(client/server) Oracle Developer Release 6.0  Form6i (i-internet)  Client/Server  Browser Versions of D2K 1) Forms 3.0&Repots 1.06.0 2) Forms 4.5 &Reports 2.5(Developer 2000) 3) Form 5.0&Repots 3.0  Supports of Wizards. 4) Forms 6i &Reports 6i (Developer 6i)  supports java  Runs application on web. What is use of front end tool. SQL PL/SQL He is technical He is non technical person Person SQL * PLUS ORACLE D2K
    • Any front tool is used to develop a application. (This for customer (or) non technical person.) Types of Interface Can you develop application using D2k? Yes (using D2K we can develop web based application.) When develop D2k application we can develop on windows plat form only. What are the criteria for purchasing front tool:  cost(what is the cost)  Operating System(it is support O/S or not)  Backend  Connectivity. D2k supports:  Windows  Unix  Linux  Macintosh  Sun O/S CUI BROWSERGUI
    • D2K Supports Backend: Oracle Non Oracle DBs Sybase SQL Server DB2 Cost: 1.5 Lakes. Connectivity:-Support by ‘ODBC’ Technical Part of D2k:- It support RAD (Rapid Application Development) Technology. RAD:-  Minimum code.  More Productivity. Is there any front tool without write single line program develop system? Yes--that is D2k.  D2k is a Default Intelligent tool.  Program required to more functionality.  It support oops (reusability)  It has automatic row level locking system.  It supports concurrent users.  D2k support Data Migration (this is export or import can do. From legacy DBs to current DBs)  Automatically Data integrity Maintained in case of Master/Detail Form/screen.
    • It supports Integration.  Excel  P.P  OLE (Object Linking embedded.)  COM(Common Object Module) it is an Integration tool. D2K:  Forms  Reports  Graphics  Query Builder  Procedures  Translator. We can develop all things separately and integrate it. It support:  Web Enabled System.  Web Based System. Web enabled System:- Working windows (or) Browser. Web Based System:-Only on Browser. Ex:-oracle ERP.  D2K supports Three Tire Arctic CLIENT BROWSER SERVER
    • Developer 6i:  Forms—Design form for data manipulation purpose  Reports—Used to retrieve data from database for a better format  Graphics—Used to design charts.  Procedure Builder– used to create subprograms that GUI mode MDI:-Multiple Document Interface.  It is not part of D2K.  It is part of O/S(windows O/S). Window:- Every new form is automatically held in a default window named WINDOW1. 1) Boilerplate (Labels) 2) Item (Fields, save, Cancel etc.) Note:-Default window will be there not requires developing it. Item:-  Item display data values, and can be edited.  Item are objects contained in block. Canvas:-  The canvas is the ‘background’ (or)  Which Items, Text and Graphics placed. Block:-  Logical container of item.  Owner of item.  Not visible at run time.  It supplying item to the canvas.
    • Note :-No Item without Block Note:-No relation between canvas and block. ORACLE D2K Table ------ Block Column --- Item Row ------- Record TABLE BLOCK CANVAS MDI WINDOW WINDOW CANVAS ITEM BLOCK A B C D A C D A D
    • Can You create without Table a block? A:-Yes. Table 1 Block A Table 2 Block B Table 3 Block C Table 4 Block D  On more than one table we cannot create one block.  Data block always depend on single table.  We can create one view on three tables then we can create a block on the view. We can create more than one block on one table. The relationship b/w table block (1: M)  Items from different blocks may be on same canvas.  Different block items may be on different canvas.  Same item cannot possible on different canvas. Canvas Item (1: M) Canvas Block (M: M) 02. Window: - There are two types. 1) Model Window:-  If it is active, we cannot navigate to any other window.  It always needs response. 2) Modeless Window:-  It is used 90 %( It is default.)  If it is active, navigation is possible to any other window
    • Canvas: - It is 5 types 1) Content:-  It is used 90%.  It is default.  It occupies whole window.  At run time only one content canvas can be display on same window 2) Stacked:-  More than one stacked canvas can be displayed on same window at run time.  Because it is displayed on top of any window or any content canvas. WINDOW When required stacked canvas:-  When you pay the fee by cash not required to open any other canvas . If it is check again you have to open another canvas. CONTENT STACKED STACKED STACKED CONTENT CONTENT
    • 3) Tab:- 4) Horizontal Tool Bar:- 5) Vertical Tool Bar:- Item:-  It is an interface object (Which user interacts).  It is two types. 1) Input item:- Accept values from user  Text-item, radio-button, check box, list item. 2) Non input item: - does not accept from user (May accept values from system)  There are two types. 1) Accept values from system:-  display item Ex: - system date on form  OLE (Object Link and Embedding) Ex: - logos, other part active x control  Chart Item Ex: - bar chart 2) Does not accept values from item:- Ex: - add, save, exit button. SUPP PRODCUST
    • FORM:- A form is a module of form builder which is saved as a file and groups or keep different form objects. ---Canvas is known as screen Hierarchy of form objects:- form  Block line for ownership.  Broken line for relationship. Components of d2k Form report graphics schema procedure query Builder builder builder builder builder builder Modules Form menu pl/sql lib object library Module module module module Programs IFDES60.EXE IFGEN60.EXE IFRUN60.EXE WINDOW CONVAS BLOCK PL/SQL TRIGGER OTHER OBJECT ITEM TRIGGER TRIGGER
    • 03--class old version Iinternet IFDES45.EXE Fform IFDES50.EXE DesDesign IFDES60.EXE 60.EXE 60version Form module: IFDES60.EXE (step1)  Used to design form.  Save source code as file.  file name(.FMB) FMBForm Module Binary. Sept2:- IFGEN60.EXE  used to generate execute file(.FMX) FMXform module executable. Step3:- IFRUN60.EXE:- Used to run.FMX file  If .FMX file not found then it generate .FMX file and run .FMX file.  It generate .FMX file only when some property is enabled. Default folder Form60 F:oracleora9iforms60 (When you saved. it will saved where oracle is installed)
    • Note:- To save /generate .FMX file User not required to provide  file name  path Q) If not save file what name it will give by default. F:orantform60module1.fmx Q) When you want transfer the application which file you can take. .FMBPortable (this can transfer) .FMXNot Portable. If machine has same platform and version (6i) We can transfer.FMX also.IFRUN60.EXE is there it will run other wise it will create .FMB and .FMX both. Working windows:- 1) Object Navigator 2) Layout Editor 3) PL/SQL Editor 4) Property Palate 1) Note:-all forms objects having own property. You can do two things through property.  look& feel  Action/(Behaviors) Object Navigator:-  All objects are found over here.  All objects are created here. Layout Editor:-To design form, some object also can be created here.
    • How to create block:- Canvas Table You can create two ways:- 1) Wizard 2) Manually 1) Wizard:- Go to data block. 2) Manually:- 1) Control Block 2) Data Block. To Changed to Data Block to Control Block Control Block to Data Block Note:-Both are possible. 1) Step1:- Start programoracle form 6i orclD2K  form builder 1) Form  module1 (+) indicate something there. Create data block  double click on date block by default :-orantd2k60module1  Give the module as some name.
    • How to generate .FMX file step1:-in D2K  Go to file from menu bar  click to administrator  click on compile file(Ctrl+T) (In interview asked) (Here .FMX file create where .FMB is saved here) IN form Builder automatic  DML  DQL **** 1) After run the form:- Tool bar  execute  un Conditional Query  un Restricted Query How to retrieve conditional value:-  Enter(1st)  Execute(2nd)  1st click on enter give condition value and click on execute Ex:-deptno—20 Q) If give Sal>2000 as conditional in Sal field. A:-We get result. Q) For complex logic? A:- open/invoke the query/where window. Setp1:-click on enter Step2:-put bind parameter in any text item Ex:-Sal Step3:-click on execute.
    • Bind Variable:-variable created in SQL it is called Bind variable. Go to deptno: Z Click on execute. It will display Query/where window. Note:-in query/where window we do not use where clause. Query:-Sal between 2000 and 3000 List Item:- Type of List Item:- 1) Poplist 2) Tlist (T-text) 3) Combobox At object navigator default Item type: =Text Item List item:-we can create through Object Nvg Layout Editor Poplist:-It is read only. Tlist:-  Read only.  We find scroll bar. Combo Box:-read and write. Q) What is default? A:-pop list is default.
    • How to populate or insert values or elements in list item Two types 1) Design Time 2) Run Time Setp1:- o Go to list item property. o click on element in list 1) In List Elements entered values we can see in list. 2) In List Item Value entered value will be stored in back end. Note:-  In case of query for list item.  Fetched data must match with only values of list item. Tlist:-change list style Tlist 1) Scroll bar will not visible at design time. 2) Scroll bar is visible only at run time. 3) If all elements of Tlist not displayed then scrollbar will come. 4) In Tlist select value is activated. Combo Box:- Note:-  Combo Box we have to give value based on table column size then it go store value. Ex: - 1) if column size 1 byteit will store only 1 character 2) If column size 5 bytesit will store 5 bytes.
    • 05—class:- Radio Buttons and Check Box:- Q) What situation you use radio button? Mutual exclusive selection. Ex:-Gender o M o F Only one button can take. (If we two values are there you can use check box also). Group:- Group1 Group2 M Y F N Create radio Button:- There 2 methods are  At Object Nvg  At Lout out Editor Step2:-  Create Radio group  Create radio button under the radio group. At layout editorautomatically system will Create radio group implicitly. At object Nvg:-  Create Itme, change Property as Radio Group. At Layout Editor:-Create Radio Button Automatically Radio Group creates. Step2:-At layout editor it asked very time the Radio group.
    • Q) We can delete all Radio Button But Radio Group will exist? A:-Yes. Setp3:-Assign values for each Radio Button  Go to Radio Button Property Label--&Male  Radio Button Value—M(This ‘M’ will go back end)  initial value  Used for default value. Ex:-Initial value-C Note:-For give Radio Button Initial value we go to Radio group Property. Initial Value-F Check Box:-Multy select. Ex:- Local Country Foreign There are two values are there  Checked  Un Checked  If checked what value should go  If unchecked what value should go.
    • Editor Type: 1. System editor (It is pre-defined) 2. User_defined Editor How to attach Editor to text Item  Go text item property.  Select system defined editor. (SYSTEM_EDITOR) How to Invoke or call Editor Ctr+E Note:-here we have use only ‘e’. Types of Blocks (Based on record) 1) Single Displayed Record Block .Form (This is Default) 2) Multi Record Block Displayed .Tabular Note:-we have to specify how many Record=3  When you take single record in FORM it will single Record Form.  When you take more than one record in FORM it will call it as Multi Record Form.  The combination of single record from, Multi records from is called Master/Detail Form.
    • (How to make single record if get by default more than one records are displayed.) Go property of data block Node--Record Number records displayed-1 How to calculate SUM of employee Sal  create one new item for totalsal  go property of totalsal Item Section--Data Data type--number Calculation --section Calculation Mode--Summary Formula -- Summary Function--sum Summarized Block--null Summarized item-Sal Go to EMP Block Property Section--Records Query all records--Yes Run the form now it will show total Sal
    • LOV (List of values)  It is a data structure like table.  It is a virtual table. Q:-In LOV data comes from where? A:-Data will come from Record Group data populated into LOV from Record Group. Record Group  It is also a data structure similar to table.  It is virtual table  It populate the data into  LOV  List Item Types of Record Group:- 1) Query Based (90% used) 2) Non Query based (or) Static Query Based:- The Record group which is associated with select Query is called query based record group.  It can be created at  Design time  Run time
    • 2) NON QUERY BASED:-  No select query associated with record group. 1) It can be created.  Only at run time. Static:-  No query associated with this record group.  It can be created at  Only design time. Note:-LOV &Record Group can be created separately. LOV RECORD GROUP QUERY
    • Note:- LOV can be created by  Wizard  Manually.  When we created LOV through wizard based on query automatically record group created Create LOV (Based on query) step1:-  Double click on LOV Node at obj nav step2:- Write the select query in SQL query statement  select *from dept Note:-Here once when you created LOV automatically Record Group also creates. LOV1 LOV2 LOV3 IT IS NOT POSSIBLE IN SIMPLE WAY THROUGH PROGRAM IS POSIBLE Record Group Record Group
    • How to attach LOV to Text Item: step1:- Go to text item property. Go lov section. List of values--lov4 How Invoke LOV:- We can call LOV F9 (Control (cursor) must be on Item (LOV item)) LOV is used for Help Box Validation Assignment How to do assignment:- Go to LOV property Click on column mapping property Node--function Click on browse button Select the Item name (I.c emp.deptno) How to create static LOV If you have less records then no need to retrieve data from table. In this case we go for static LOV. Step1:-  Create record group (manually)  DB click on Record group  select static  say ok  Mention all the column in record group.  create LOV manually  go to LOV property
    • Node-- function Record group--deptrg MASTER AND DETAIL 1. Create one block with single record (form) on dept Table. 2. Create one block with multi record (tabular) on EMP table. How many records you want to display How to make the relationship between this block NOTE: - Each block having the relation node. 1. Double click on master block relation node. 2. We get new relation. 3. Check on select. 4. Select detail block name e.g.:-EMP. Write the join condition. emp.deptno=dept.deptno This is block name (not table name).  Click on OK. Once mention d2k give integrate rules will Applied Automatically. (OR) When we create relation, automatically 03 triggers Will created. One trigger on form level Two triggers on master block level Three program units created Trigger on form level:- On-clear-details
    • Block level:- On-populate-details On-check-delete-master Program units:- Check-package-failure Clear-all-master-details Query-master-details  Run this Now in form You select 10 deptno it will all details of EMP 10th deptno. Q).what is the default relation name will give Automatically at dept-emp. Delete condition for master records/child records.  Cascading  Isolated Non-isolated  default Cascading:- If master record delete child record automatically Delete. Isolated:-if master record delete no effect on child Record. Non-isolated:-we cannot delete master record any Corresponding child record exits. If you change relation what trigger will created:- Isolated:- On-clear-details  form level On-populate-details Block level Note: here ‘On-check-delete-master’ trigger will be removed No changing on programming units. Test removes relation and select cascade
    • Query:- Cascading:- On-clear-details  from level On-populate-details  block level Pre-delete  block level Q).if cascading what trigger will get newle pre-delete Program units are:- Go record Remove all records now If you save then it commit. Co-ordination property:-  It defines the query behavior of detail block.  It decides how detail records will be displayed for corresponding master record. It has 3 types 1. Deferred (means lately). 2. Auto-query (detail block). 1. Deferred:-if you select master data, then detail will come or not will decide here. (Or) Detail record not displayed with master record at same time Differed 2 types:- 1. with auto-query 2. With out auto-query 1. with auto-query:- If we click anywhere in detail block, automatically Child records will be displayed. 2. With out auto-query:- In this case we have done for query for detail record separately.
    • 2. Auto query:- Master record and child records displayed same time automatically It has no meaning if differed no} Auto query no} then default auto query will run. Prevent Master less operation:- (It will appear in master block in property of relation name) When we go for does operation on detail block I Don’t check master data through this. Yes--You cannot do any operation in detail without any master record. No--(this default) you can do any operation in detail without any master record. 2nd Method for create master and detail block How to create relation during creation the Detail Block:-  create data block (for detail)  auto-join data block(un checked it)  click on creation relationship  Click on OK.  Select master block name (dept may have more than One relationship).
    •  Say ok.  Select common item name form. Detail item master item Deptno deptno  Next.  Remaining steps are same. Where you can write program.  SQL  PS/SQL  BUILT-INS  USER-DEFINED OLE:- Object Linking and Embedding (OLE) was introduced to support the cooperation of separate applications presenting a single compound document. TRIGGERS:- Create trigger <trigger name> After/before insert/update/delete On table name For each row When <condition> Declare Begin Exception; End; FORM TRIGGER:- It is pl/sql block which is associated with events. It is used for:
    •  To add more functionality to form.  To process data  To impose validation It is execute against event associated with it.  d2k having own events. Types of events:- 1. External 2. Internal Externalis done by user (press the key click mouse). Internalit is occurred due to navigation. Components of triggers:- 1. Type 2. Scope 3. pl/sql code 1. Type:- Type of triggers identifies the name of the events take Action event. 2. Scope:- Trigger should be executed in which area (level) SCOPE OF LEVELS 1. Form level 2. Block level 3. Item level NOTE:-all triggers cannot be written at all levels. 3. pl/sql program:- Program body of trigger allows to write
    • TYPES OR TRIGGERS 1. Pre 2. Post 3. When 4. On 5. Key 1. PRE:- It is fires just before event take place or deleting Pre-form Pre-block Pre-text-item Pre-record 2. POST:-it fires just after event take place or deleting. Post-form Post-block Post-text-item Post-record 3. WHEN:- It fires just after default processing done When control reaches to the object. When-new-form-instance When-new-block-instance When-new-item-instance When-new-record-instance
    • 4. ON:-It is used for replacement of default processing  Generally it is used for non base table. On-insert On-update On-delete 5. KEY: - some triggers associate with key.  They are called key triggers  They are fired when we press the keys. Key-next-item (Tab/enter keys) (Arrow keys) key-up Key-down Key-nxtrec (next record). CREATE TABLE product master (Product no varchar2 (6) constraint Pk_product_pk primary key, Description varchar2 (25), unit_measure varchar2 (10), Qty_on_hand number (8), Reorder_lvl number (8), Cost_price number (10, 2), Selling_price number (8,2))
    • Restriction:-  product_no is primary key  First letter of product_no must start with ‘P’.  Description, Unit_Measure, Selling_Price and Cost_Price cannot be left blank.  Qty_On_Hand should have a default value of 0  Qty_On_Hand is not enterable.  Selling_price cannot be 0  Cost_Price cannot be 0  Selling_price cannot be less than cost_price.  Create synonym prod_master for product_master.  Create a data block on synonym (prod_master)  Form name PRODUCT:  Data Block Name Product_master  Canvas name Product_can  Window name Product_win For a Title Node—functional Title—Product Information
    • Last Push Button names:- Labels Pb_add Add Pb_view View Pb_modify Modify Pb_delete Delete Pb_save Save Pb_exit Exit Pb_first First Pb_prior Prior Pb_next Next Pb_last CLASSIFICATIONS OF TRIGGERS:- All are internal triggers (based on action) 1. Interface trigger 2. Navigation trigger 3. Query trigger 4. Validation trigger 5. Message trigger 6. Transaction trigger 7. Block processing trigger
    • 1) Interface trigger:-  This trigger is associated with external events. A) General B) Mouse C) Key A) General: - (Or) Action Trigger Trigger that get execute due to user interaction are called Action Trigger. When-button-press When-radio-changed When-checkbox-changed When-list-changed When-list-activated (T list) When-window-Closed B.Mouse:- When-mouse-click When-mouse-doubleclick When-mouse-enter When-Mouse-Leave When-Mouse-Move C) Key:- Trigger Name Key Key-next-item Tab or Enter Key-up Key-down Key-ExeQry F8 Key-NxtBlk Shift F5 Key-Commit F10
    • 2. Navigation trigger:-  It is internal trigger Pre:- When-new-<object>-instance Ex:- When-new-form-instance When-new-block-instance When-new-item-instance When-new-record-instance Post:- 3. Query processing trigger: - 2 types 1. Pre-query 2. Post-query 1. Pre-query:- It fire only once for all row fetched. (Before fetching any row it will fire) If data is there do query 2. Post-query:- 1. After fetch the row 2. It is fire for each fetched row NOTE:-both are block level triggers. 4. Validation trigger:- 1. It is validation of data (It used to check data when enter in field) 1. when-validate-item (it is only item level) 2. when-validate-record (it is on block level)
    • 5. Message trigger:- 1. Informative message 2. Error message NOTE:-message displayed by the form builder at run Time can be changed. 1. Informative message both are using for On-message form, block, item 2. Error message levels On-error 6. Transaction trigger:- 1. Pre 2. On 3. Post 1. Pre Pre-insert Pre-delete Pre-update 2. On On-insert On-delete On-update 3. Post post-insert Post-delete Post-update 7. Block processing trigger:- 1. when-clear-block 2. when-create-record 3. when-database-record 4. when-remove-record.
    • Variables used in d2k:- 1. pl/sql variables 2. Item variables 3. Global variables 4. System variables 5. Parameter variables 2. Item variable:-item can be used in variable. : [colon] is prefix 2-5 variables are called bind variable. Any variable use: it called bind variable. :[< block name>]. <Item name> Ex:- : emp.empno Declare Vsal number (8, 2); Begin Select Sal into vsal from EMP Where empno=7500; : emp.emp_sal:=vsal; : This is not using in normal pl/sql using in d2k. IN D2K Begin Select Sal into: emp.vsal From EMP Where empno=:emp.empno;
    • NOTE:-in d2k some cases we can write Program “without BEGIN &END Block” Syntax for lov Ex:- Show-lov (‘dlov’); 3. Global variable:-used to pass the value to 1. With in the form 2. form to form 3. Form to report/graphics It can be declared at 1) Form level 2) Block level 3) Item level.  data type =char  maxi size is 255 Note:-This is the drawback.  It is open till session (it has poor memory mgt)  it is use one key word ‘GLOBL’ : (colon) is prefix : GLOBL. <Variable name> Ex:- : global.code TRIGGERS:- When-new-form-instance When-new-block-instance When-new-item-instance
    • Initialization is must :global.code:=‘A’; 4. System variables:- At run time form builder maintain Form status in to system variable.  Means it is declared & maintain by form builder itself.  Users can not declare (or) assign in to system variable. Exception:- In specific cases some system variable can be assigned by user.  Data type=char  Value=uppercase (...some cases lower case also)  User can use system variable if require.  it is used one key word ‘SYSTEM’ :system.<variable name> :system.block_status Key word block status  It is used generally to right generic programs (Flexible code) NOTE:- for more details system variable go to ‘help’ 5. Parameter variables:-  it is used to pass the value 1. With in the form 2. form to form 3. Form to reports/graphics Data type=number/char/date Size=respective
    • 4. Not open till session 5. It is created at object navigator at design time. 6. It is used with key word ‘parameter’ Syntax:- :parameter.<variable name> BUILT-INS:- It is predefine ‘sub programs ‘as part of d2k Sub programs are 2 types 1. Procedure 2. Function All built-ins are part of pre define Packages are 2 types 1. Standard extension (all built-ins kept) 2. Others text_IO (name) NOTE:-the package name not used as prefix with Built-ins 200+procedures+functions are there. CATAGEORY OF BUILTS are 2 types 1. Restricted 2. Unrestricted 1. Restricted:-it is not allowed on all triggers the Built-ins which initiate navigation restricted built-ins Ex: - go-block Go-item Next-item Next-record 2.un restricted:-allowed on all triggers Ex:-message (-------)
    • Show –lov Show-lov (‘lov name’); All built-ins use:- 1.save:- Commit-form; Clear –block (do-commit); Clear-block; (or) Clear-block (no-commit); Clear-form (do-commit); Clear-form (no-commit); Commit; (this is converted to commit-form) Delete –record; Update-record; (this block level) 2. NAVIGATIONAL BUILTINS:- Go-block (<block name>); (it is used for jumped from One block to another block) Next-block; Go-item (<block name><item name>); Next –item (it is require); Go-record (<record no>); Next-record First-record Last-record Previous-record Go-form (<form name>); Next-form Previous-form
    • Show-lov (<lov name>); List- values (if lov is attached to item then) Show-editor (editor-name) Edit-text item (editor attach with item) Show-view (<stacked canvas name>); Hide-view (<stacked canvas name>); Show-alert (<alert name>); Execute-query; Set-<object>-property (arguments); Set-window-property (); Set-block-property (); Set-item-property (); Set-lov-property (); Set-alert-property (); Set-form-property (); Get-<object>-property Get-application-property (); Add-list-elements (); Through this programs put values or used to populate The list item automatically through this program. Message (‘msg string’)—pro display the message. Create a button lov when you click on that button Lov should display. (Or)
    • HOW TO CALL THE LOV THREW PROGRAMS  Double click on lov  Select lov wizards After finishing this process lov will be created  change Lov name as deptlov  Create one push-button  Right click choose PL/SQL Editor  Write code here. Declare Vlov boolean; Begin Vlov: =show_lov ('deptlov'); End; As soon as the form is opened in memory A series of navigational trigger are executed. The sequences of triggers that fires when a form is invoked are as follows. Sequence Trigger Name Remarks 1 Pre-Form The trigger gets executed even before the form is displayed. 2 Pre-Block This Trigger fires while entering the block and also during navigation from one block to another. 3 Pre-Record This trigger fires for the first time before entering the first record in the first block on the for Subsequently it fires before navigation to any record in that block.
    • 4 Pre-Text-Item This trigger fires for the first time before entering the first enterable item in the first block on the form. Subsequently it fires before navigation to any item in the block. 5 When-New-Form-Instance This trigger fires when the forms focus is on the first item in the first block after form displayed. 6 When-New-Block_instance This Triggers fires after the cursor is ioned on the first item of the block and also during navigation from one block to another. 7 When-New-Record-Instance This trigger fires when the forms focus changes from one record to the other. 8 When-New-Item-Instance This trigger fires after the cursor is positioned on the any item the form and also during navigation from one item to another. The sequences of trigger that fires when a form is closed are as follows:- 1 Post-text-item It fires after leaving the current item. 2 Post-Record It fires after leaving the current record. 3. Post-Block It fires after leaving the current block 4. Post-Form It fires just before exiting the form. SMART TRIGGER:-  Introduced in form 5.0  It is a collection of frequently used triggers. With respect to object where control currently located  Right click on list box  Select smart script  Frequently used triggers available  List of values it is also used to invoke lov if it is attached to item.
    • How to find duplicate values when enter. threw program on EMP table. Trigger—key-next-item Itemname—empno Declare CNT number (5); Begin Select count (*) into CNT From EMP Where empno=:emp.empno; If CNT>0 then Message (‘the empno is already existing ‘); Else next_item; End if; End; NOTE:-  Suppose we want to display the message as Model Window  Give 2 times message it will display Model window.
    • -: ALERT :-  An ALERT is modal window that display a message notifying the operator of some application condition.  It is a form object  It is used to display the decision message  It is display as ‘Model Window’ There are three styles of alerts:  Stop  Caution  Note Here each style denotes a different level of message severity. Note:- Alert style Node—Functional Alert Style-- It has 3 buttons. Button 1 Label --Ok } Button 2 Label ---Cancel} Both are by default Button 3 Label --we can give any third message (Ex:-Delete) You can enter up to 200 characters It is invoked threw program Show_alert ( ); HOW TO CREATE ALERT:- Step1:- Create alert Double click on alert Node in Object Navigator (Then change the name if it necessary)
    • Step2:-  Then right click on alert  Go to Alert Property  Provide a message for alert Functional- section Give the message for Alert Message-Do want to delete Step3:- Invoke ALERT. HOW TO INVOKE THE ALERT:- Show_alert()  It is a function  It return one numeric value  To return number type value PROGRAM FOR CALL FUNCTION:-  Create one button for Alert  Give as name Alert then right click go to PL/SQL Editor Trigger--When_Button_Pressed Declare valt number; Begin valt:=show_alert(’DELALT'); end; (--DELALT is alert name.) DECLARE valt number; BEGIN valt:=show_alert('DELALT'); --for Button 1 IF valt=Alert_Button1 THEN
    • DELETE_RECORD; --COMMIT;--if we save after delete. --for button 2 ELSIF valt=Alert_Button2 THEN Message('Deletion Canceled'); Message('Deletion Canceled'); --for Button 3 ELSE Message('Nothing Deleted'); Message('Nothing Deleted'); END IF; END; How One Alert can be used for different Message? Button—delete Trg--when_button_pressed DECLARE valt number; BEGIN --seting the message of next set_alert_property('DELALT', Alert_Message_Text, 'Do you wnat delete??'); --it for setting title. set_alert_property('DELALT', Alert_Title_Text,'delete??'); valt:=show_alert('DELALT'); --for Button 11 IF valt=Alert_Button1 THEN DELETE_RECORD; --COMMIT;--if we save after delete. --for button 2 ELSIF valt=Alert_Button2 THEN Message('Deletion Canceled'); Message('Deletion Canceled'); --for Button 3 ELSE Message('Nothing Deleted'); Message('Nothing Deleted'); END IF; END;
    • Changing the alert message at runtime.  we can change an alert message at run time by executing the SET_ALERT_PROPERTY Trigger:-When_validate_item CODE—MGR (ITEM) DECLARE ALERT_BUTTON NUMBER; BEGIN SELECT ENAME INTO :MANAGER FROM EMP WHERE EMPNO=:MGR; EXCEPTION WHEN NO_DATA_FOUND THEN ALERT_BUTTON:=SHOW_ALERT( 'MANAGER_ALERT'); RAISE FORM_TRIGGER_FAILURE; END; Q)Create a two button alert for the emp form,which will be displayed in case operator enter an invalid salaryi.e outside permitted range,for check. It should have two buttons, ‘OK’ and ‘Cancel’. If the operator choose ‘OK’,Accept the salary else re_enter Step1:- Create an alert ,’SAL_ALERT’ of Caution type. Step2:- Define two button,’OK’ and ‘CANCEL’
    • Trigger:-when_validate_item Item name—sal DECLARE ALT_BUTTON NUMBER; BEGIN IF :JOB='CLERK' AND :SAL>2500 THEN ALT_BUTTON:=SHOW_ALERT(‘SAL_ALERT'); IF ALT_BUTTON=ALERT_BUTTON2 THEN /*CANCEL*/ RAISE FORM_TRIGGER_FAILURE; END IF; END IF; :GROSS:=:SAL+NVL(:COMM,0); END; When_validate_item  IF :MAIN.UID IS NULL THEN MESSAGE('Enter UserId'); RAISE FORM_TRIGGER_FAILURE; END IF; How To invoke Stacked Canvas:-  canvas stacked (Block dept)  canvas content(Block emp)
    •  Create one block on dept(deptno,dname,loc)with staked  Click on call Button its open another canvas(content) 1) Canvas stacked canvas for dept block(deptcan) 2) Canvas content or stacked for emp block(empcan) Button ---call (empdetal) trigger-- when_button_pressed show_view(‘empcan’); Note:-  The call button must be out of calling area  You can not call from content to stacked  You can call stacked to stacked For position change:- view port—section(deptcanvas) view port x position-0 view port y position-0 Width—425 Height—324
    • For position change (empcan) view port—section(empcanvas) view port x position-0 view port y position-200 Width—450 Height--150  it hide deptcan canvas  go back to empcan canvas create one button on deptcan Button--OK Trigger--when_button_pressed Go_block('emp'); Hide_view('deptcan'); For Show Editor:- Trigger--When_mouse_Doubleclick code—Remk(I.c text_item) Declare OK Boolean; BEGIN Show_editor(‘System_Editor’, :Remk,:Remk,Ok); END; Note:- here :Remk is item name
    • Global Variable:- Note:-  First create one block on emp table  create one block manually (one text item TO receive deptno)  block sequences first should be emp block step1:- Trigger-when_button_pressed Block-emp Button OK code :GLOBAl.var:=:emp.deptno; :TB.TI:=:GLOBAL.var; go_block(‘TB’); System Variable:- -->It used by form build -->It keep or store the status at run time. :system.block_status
    • 1)New 2)Changed:- -->Insert -->Update -->Delete 3)Query :SYETM.BLOCK_STATU OK--Button IF:system.block_status=‘CHANGED’ THEN clear_block(do_commit); else Message(‘No data to be saved…….’); Message(‘No data to be saved…….’); end if; Note:- we can give the clear_block; Commit; Parameter variable:-
    • Step1:- Create parameter at obj nav Name as pdno :tblo.dno:=:parameter.pdno; Trigger--when_button_pressed Button--OK :parameter.pdno:=:emp.deptno; :tblo.dno:=:parameter.pdno; go_block('tblo'); POST_QUERY:- Trigger--post-text-item Item--dname(write code here) select dname into :emp.dname from dept where deptno=:emp.deptno; Note:- Go to dname item and click Enter key will get that a corresponding dname of deptno. If duplication data enter it should not save and enter other data it should save. Trigger—when_validate_item Item—empno Block –emp declare cnt number(20); begin
    • select count(*) into cnt from emp where empno=:emp.empno; if cnt>0 then message('Duplication empno'); message('Duplication empno'); raise form_trigger_failure; end if; end Key-next-item Go-block(‘BLKB’) When control leaving block post-block will fire. How Trigger will fire what is sequences 1) When-validate –item 2) post-text-item 3) when-validate-record
    • 4) Post-record 5) Post-block 6) Pre-block 7) Pre-record 8) pre-text-item 9) when-new-block-instance 10) when-new-record-instance 11) when-new-item-instance Note:- If pre-text-item trigger failed, the control goes back to the original place.(I e. go back to Block A) What is navigational Trap:- It called also Fatel Error If PRE-TEXT-ITEM trigger failed from source and target both then navigational trap situation arises. It is known as fatal error.
    • Trigger execution hierarchy:- EH/ES Execution Hierarchy Execution Style  When we write same trigger in different level the which trigger will fire first  It is decided by EH/ES where the property will there  Go to trigger property  Node--functional Execution hierarchy Override After Before How to maximize the form -->go to form level trigger--when_new_form_instance -->for maximize the MDI windowset_window_property (Forms_mdi_window,window_state,maximize); -->for maximize the ‘window’--under same same trigger Set_Window_Property('krishna', WINDOW_STATE,maximize); here ‘krishna’ is window name we can fined it under window at obj nav.
    • SET_WINDOW_PROPERTY( FORMS_MDI_WINDOW, WINDOW_STATE, MAXIMIZE ); SET_WINDOW_PROPERTY( FORMS_MDI_WINDOW, TITLE, 'MANTECH' ); SET_WINDOW_PROPERTY( 'WINDOW1', WINDOW_STATE, MAXIMIZE ); --SET_WINDOW_PROPERTY( 'WINDOW1', TITLE, PROPERTY_FALSE ); SET_WINDOW_PROPERTY( 'WINDOW1', TITLE,'App_Wolrd'); declare cursor primary_cur is select 'x' from u_tab where USERID = :UID; primary_dummy char(1); begin open primary_cur; fetch primary_cur into primary_dummy; if ( not primary_cur%found ) then message( 'Unknown user ...'); close primary_cur; raise form_trigger_failure; end if; close primary_cur; end;
    • How to create different buttons if menu is not there find a default menu -->Go property of form (default name--module1) -->node-- functional menu module--DEFAULT&SMARTBAR (default menu name) -->Remove the default menu For query Processing trigger --When_button_pressed button name--ExeQuery built_in--execute_query; For exit form trigger --When_button_pressed button name--Exit built_in--exit_form; For refresh form trigger --When_button_pressed button name--Refresh built_in clear_block(No_commit); Note:- -->if we not specify no_commit here. -->You change the data, -->It will ask do you save.
    • What is execute_query:-  It is built_ins  It clears the Block and executes the query.  It does not accept conditional value. From the query block.  It always checks the conditional value at where clause of query block. What is execute-Query?  It built-Ins  It clears the block and executes the query  It does not accept conditional values, from the query Block  It always checks the conditional value at where clause of query block. Control Block Method:- 1) Control Block(blk) (here create one text item name -pno) 2) Data Block(emp) Level of Trigger—Form Trigger --when_new_form_instance :global.pno:=:emp.deptno; execute_query; set_window_property(Forms_mdi_window,window_state,maximize); Set_Window_Property ('krishna',WINDOW_STATE,maximize); Block-emp Button name—Query Trigger—when_button_presed set_block_property('emp', Default_where,'empno='||:empno); clear_block(no_commit); execute_query;
    • Calling form:- write in Supp Button for called fome. When_Button_Pressed syntax:- call_form(<forms name>,display_mode, switch menu_mode,query_mode ,parameter list); <form name> is mandatory all others are optional (fmx name Awith path.) ex:-’d:krishnaformsformb.fmx display_mode hide no_hide Hide:- calling form will not be displayed when called form invoked. No_Hide:- calling form and called form both displayed. Switch menu-mode No_Replace -->calling form menu will be displayed
    • Do_Replace:- -->Called form menu will be displayed.4 Query-Mode:- Query_only -->Called form used only for -->DQL -->No DML No_Query_Only:- -->DQL -->DML call_form ('C:Documents and sttingsAdministratorDesktopgv.fmx',no_hide,no_replace,query_only); Parameter list:- It is Mechanism to pass value from calling form to called form. Open-Form:- -->We can open more than one form. -->Navigation is possible between calling form and called form. -->After Exit called form,control goes to calling form. Syntax:- open_form(<form name>,active_mode,session_mode, Query-mode,Parameter list); Active_mode:- -->Active -->No_active
    • Active:-Control is on called Form. No_Active:-Control is on calling Form. Session_mode:- Session Called form using different database. No_session:- Called form using same database of calling from . New_form:- -->We can call only one form. -->Calling from is exit out. Note:- -->If calling form is itself called by only another form,then control goes to another form after exit from called form. Syntax:- New_from(<Form Name>,Rollback-Mode, Query_mode,parameter list); Roll Back:- To_savepoint NO_ROLLBACK Full_RollBACK
    • -:Menu:- It provides the option To Invoke Form/module Report Graphics Components of menu 1) Main Menu 2) Submenu 3) Menu Item File-->main menu New -->Menu Item Close Sub menu .MMB (Menu Module Binary) it is source code .MMX (Menu Module Executable) (executable code.) How to create Menu:- -->Double click on Menu Module -->Double click Menu Editor -->create different -->sub menu -->Menu Item
    • -->save the file as .MMB (it should be in same location of .fmb -->generate .MMX file. -->go to file -->go administrator -->click on compile file (or) ctr+t Note:-we will get error here. Restriction:- -->To compile the menu all item must have PL/SQL code. -->we write PL/SQL code only on Item. Under in Exit menu Item : Exit_form; Open menu Item Go_Block(‘supp’); Attach Menu to form:-  Go to form property of form  Go to Menu Model— C:Documents and SettingsapplmgrDesktopempmenu.mmx Create main menu which having following
    • Types of Menu Item 1) Plain 2) Separator 3) Radio 4) Check 5) Magic Dept_det PL/SQL Block Built In go_block('dept'); Salgrade_det PL/SQL Block Built In go_block(‘salgrade'); Exit Exit_form; For separator  Create one menu Item Node--Functionl Menu item Type – Separator(This only for separator. ) After the create Close Menu Item. Note:-Run the .mmx file very time if do any changes Close Exit_form; ( or) Menu Item Type—Magic Magic Item—Quit
    • For Creating Magic Item:- Let take one example here. Edit—sub menu Step1  Create menu Item  Copy  Cut  Paste Cut Select the menu item(Cut) Go to property Node—functional Menu Item type—Magic Magic Item—Cut Similarly Copy Menu Item type—Magic Magic Item--Copy Similarly Past Menu Item type—Magic Magic Item--Past Popup Menu(short Cut) (It is introduced in 5.0 ) It is Created in Form module
    •  Double Click on popup menu  give name as –popupA  Go to menu editor frame menu Note:-  In popup menu no concept of main menu.  it has only sub menu  menu item Under Menu Editor menu item(dept_det) menu item(salgrade_det) menu item(exit) menu item(copy) menu item(cut) menu item(paste) Repeat the same steps from code in menus. Attach Popup menu to any Item (or)Canvas  go to canvas/item property  in canvas/ item property Node—functional Popup Menu—popupa  Run the from Note:-  When right click any where on canvas the shot cut menu will display.  if attached to item(empno),go the item right(empno) click on item the popup will displayed.
    • Messaging System  Form Builder display the different type of message to user at run time.  These message can be  changed  suppressed Note:-  All messages can not be  changed  suppressed MSG Type 1) Information MSG (All success message called informative MSG) 2) Error MSG 3) Working MSG 4) System Alert 5) Application MSG 6) Application Alert MSG can changed using ON_Message Trigger ON_MESSAGE Trigger  Form Level  Block Level  Item Level MSG reporting Built_Ins are  Message –Code  Message –Text  Message –Type
    • Component of MSG  Type  Code  Text Type:- Ora(Back End) Frm(Fornt/End) Code:-error number Text:-MSG String Error MSG (Built-ins are)  on_Error  Error_code  Error_text  Error_type Working MSG:-  Working MSG Displayed from form Builder during the processing can be suppressed. How to do this/system Alert:- Using one system variable :system.suppress_working Q):-Which system variable can we assing value? A:- Suppress_working default=‘FALSE’
    • Ex:- :System.suppress_working:=‘TRUE’; (When_new_form_instance) Severity Level of MSG:-  all MSG displayed by Form builder having some number assigned by from builder  This number of MSG is called severity level,means how much the message is sevior/critical. Different Pre_defined Level:- 0all other msg 5due to obvious reason (if enter ename in empno it error ) 10Due to procedure mistake. 15due to form is not designed 20due to trigger failure. 25Form is Incorrectly used Message can be suppress using one system variable :system.message_level=15; (up to 15 message will be suppressed ) Default is 0 Default=0; When_new_from_Instance :system.message_level:=15; FRM:40400 (successful message) when saved the data
    •  all message can not be changed at all level.(form,block,item). Commit message can be changed at block level. Level—Form Trigger—On_Message IF message_code=40400 then message('record has been saved sucessfully........'); message('record has been saved sucessfully........'); ELSE message('Mesage_text'); END IF; Object orient programming(OOPS) In D2K:- Used for  maintain the standard(same color etc)  More productivity  Easy maintain D2k provides 6 components:- 1) Property Class 2) Visual Attributes 3) Object Group 4) Program Unit 5) PL/SQL Library 6) Object Library
    • 1)2)3)4) are used within form module Not used across the form. 5)6)These modules are used Across the form 1) Property Class:- It is used by define useruser-defined property It is named object that contains a list of properties and their values. CLASS: Type of property:-  Variant  Inheritance Steps 1) Double click on property classes(PC) 2) Give name as PCTXT 3) Go to Property Class property 4) (+) click on add(+)(i.c add icon bar) I)select width -- 100 Height -- 30 Font Size -- 20 Foreground color-- Magenta DATE STRINGRADIO NAME ENAME ADDR THIS CALL INHERITANCE
    • Assigning the property class to other objects on the form:  go to Item property o node –general  subclass information --click on it(….) o sub class information dialog box will be displayed  select property class radio button.  select the property class name.  click on ok button Note:-The properties of the item that are inherited form the property class will display an red arrow.  if you remove subclass information you can see the time default size width-1 high-0 inserted of remove it go to item property and in place of property class name give NULL 2)VISUAL ATTRIBUTES 1).Used to maintain standard of  look &feel(font)  color How to create visual attributes:- 1).double click on visual attributes. 2).give name as vatxt. 3).go to va property. color:-blue 4).go to the item property. (empno) 5).go to visual attribute section. 6).select visual attribute group:-vatxt.
    • How to attach the visual attribute to block go to block property visual attribute--section visual attribute group--VATXT Record--section current Record visual attribute group--VATXT 3) OBJECT GROUP  It is logical container to keep parent object only  which can be reused.  it keeps only reference of object. How to create the object group:-  Double click on object group.  Give name as –objgro.  Drag &drop the parent object.(io emp block)  Go to new parent object property. (here one more control block(BLKA) and create one canvas(BLKCAN))  Go to new parent object property (blka) subclass information--emp and new object emp. 1).create one canvas. 2).drag canvas. 3).I.e.:-can-dept. NOTE:-we can use canvas and when create any new canvas you can get the use the other interaction.
    • 4).PROGRAM UNITS:- It is used to right the o Procedure o Function o Package Which you can be reused.  DB click on program unit  Give name procA  create a button ‘count’  write a program for this button Trigger—When_button_pressed DECLARE RECNO NUMBER; BEGIN SELECT COUNT(*) INTO RECNO FROM EMP WHERE DEPTNO=:DEPTNO; MESSAGE('THE NUMBER EMP'||RECNO); MESSAGE('THE NUMBER EMP'||RECNO); END; PROCEDURE procA(PDEPTNO NUMBER, PCNT OUT NUMBER) IS VCNT NUMBER(2); BEGIN SELECT COUNT(*) INTO VCNT FROM EMP WHERE DEPTNO=PDEPTNO; PCNT:=VCNT; END;
    • How to call procedure:- W-b-p procA(deptno,countitem); PL/SQL Library:- It is a first module .PLL (PL/SQL library)  It is used to write the  Procedures  Function  Package  Which can be reused across the form.  DB click on PL/SQL L/B model  It is not change the name  The same PL/SQL library can be attached to  multiple forms and menus. There are three library files.  .PLL  .PLX  .PLD 1).PLL :-  It contains both library source code and the Complied  The .PLL is created or updated when it is saved in the library module. (platform-specific p_code(Executable code)
    • 2).PLX:-  It is a platform-specific executable.  This complied p_code is need when an application is ready to deployed. 3).PLD:-  It is text format file and can be used for technical  Documentation of the library files.  The PL/SQL subprograms can define in library  procedures  Functions  Package Specifications  Package Bodies. Nag:- 1)FilenewPL/SQL Library (Or) 2)Node Libraries  To change  To save the file and give the name emp_pll  DB click on program unit  same as above program in  procA  procB How to use program of PL/SQL  In PL/SQL editor,define appropriate program unites and then compile and apply modifications.
    •  An Object Library is a container for form objects.  You can drag any number of individual objects such as block, items, canvasses, windows, or property classes into a library for reuse in other modules. Benefits of object Library:-  Simplifies sharing and reuse of object.  It provides control and enforcement of standards.  It eliminates the need to maintain multiple referenced forms. Objects included in an object library:- • Alert • Block • Canvases • Property Class • Visual Attributes • Windows Create an object library and placing object in the object Library:-  Create an object library name give any (emp_objlib.olb)that stores object.  The Object Library is collection of one or more Library Tabs.  DB click on the Library Tabs Node to create a new Library tab in the object library.  default name is LIB_TAB0 give name as (LIB_VATTR)  Go property of LIB_VATTR and give label(VATTR)  Create another Library tab stores a property class. The new library tab property as Name—LIB_PC Label--PC  open appropriate tabs in the Object Library for place object Nag:- Toolsobject Library  select the visual attributes objects in form module And drag and drop it on the VTTR tab in Object Library.  Repeat the same step for Pclass.(in this case PC tab must be active ).  Forms Builder displays a dialog box as show asking for copying or subclasing the dra
    •  Reports are used to extract necessary data from a oracle table and displayed it on VDU or printer.  The process of data extraction and its displayed is called Report creation.  for report creation oracle provides a GUI based report writer tool called Oracle Reports Builder. What is oracle Report:- Oracle report is tool for developing,displaying and printing production-quality reports. Report6.0 .RDF(Report Definition File) Component Of Report:- Data Model(Mandatory):- Layout Model(Mandatory):- Data model and Layout Model in witch the structure and format of the report can be created. Parameter Form(Optional) Report Trigger(Optional) Data model:- A data model is composed of some or all of the following data definition objects. • Queries • Groups • Columns • Parameters • Links.
    • Queries:- • Queries are SQL SELECT statements that fetch data from the oracle database. Groups:- Groups determine the hierarchy of data appearing in the report, and are primarily used to group columns select in the query. Note:-Oracle repots automatically creates a group for each query. Pre_Defined Repot format:- • Tabular(90% used) • Group Left(Group Report) • Form-Like(Master/Detail Report) • Group-Above • Mailing Label(Complex Report) • Matrix(Complex Report) • Form Letter • Matrix With Group • There are 8 reports format • Group Left:- 10 ------------ ------------ 20 ------------ ------------ • Group Above:- 10 ---------------- ---------------- 20 ----------------- -----------------
    • Matrix and Matrix with Group  Used for analyses  It is called dimensional report  It is complex report Steps:-  Select the Repot Builder Navigation 1) startprogramsoracle Report6i Report Builder 2)select Report Wizard. 3)
    •  Break report is created with repeating values for a column have to be printed only once.  Thus the break reports are effective only when the select statement includes a column called a break containing at least one value which repeats over multiple records. Step1:-  select Group Left as a presentation style. Step2:-  enter the SQL statement as in the Data Tab. SQL> SELECT Ename, Empno,Sal, Emp.Deptno, Dname,loc FROM Emp,Dept WHERE Emp.Deptno = Dept.Deptno;  Group Left report requires the name of the column that must be used as a break column. step3:-select the deptno is repeating as the multiple items are selected for every order. Step4:-deptno is displayed in the group filed. Note:-The list of columns that must be displayed on the report is asked. Step5:-  Select all columns. Step6:-  select sal in calculation totals page (if it requries tol sal)  Change the label for empno as emp num in label page step7:-  select ‘Cyan Grid’ presentation style and click on finish in Template screen. Repeating Frames:- Repeating frames are called so because repeating frames are repeated as many times as necessary to display all the records.  The report layout contains two repeating frames.  The first repeating frame includes columns deptno.  All other columns are included in the second repeating frame.
    •  Whenever we need to report like for each master record fetched only the related detail recorder.  It has two groups of data . Data Link object:-  It is a data model object,which joins multiple queries. Note:- Join defined by data link object is an Outer Join. Layout:- master/detail report uses Group Above layout style. (I.c in which master record display across the page with the label to the left of their fields and the detail records apper below the master records in tabular format. Creating the report definition:-  Master/detail report can be created using two queries. Step1:- For master query:-  Right click on data model and select report editor.  select query object from the toolbox and place it on the report work area.  Enter the query in SQL Query statement Dialog Box SQL> SELECT Deptno, Dname, Loc FROM Dept;
    • setp2 For detail query:- Create one group with following query: SQL> SELECT Empno, Ename, Sal, Deptno FROM Emp; Note:-Two groups are created. Note:-here the name of  Query object is Q_1  Group object is G_1  The name of the data base column are the same as defined in the SQL query.  Open the property palette of Master and Detail Q_1,G_1 and change the  name of the in Master Group  Query object to Q_master  Group to G_master name of the in Detail Group  Query object to Q_Detail  Group to G_Detail Note:-If data columns with the same name are included in the Report groups,the data columns will be renamed by using column name followed by an integer Value starting with 1. Step3:-  Select the Data link tool and click and hold on the Deptno column of the G_master group.  Drag the mouse pointer to deptno column of the G_Detail group and release.  Open the Data Link property sheet by Double clicking on the data link.  we examine the all relationship here where is the default clause used in master/detail relationship.  The link is used to established by using a where clause and an equality sing(=)
    • Step4:-  Select Tools..Report Wizard to define the report format.  select presentation Group Above as show in diagram  Select displayed two groups into displayed groups. Master and Detail manually  Go to report builder and select build report manually  create master group on dept table.  Open the property palette of Master  name of the in Master Group  Query object to Q_master  Group to G_master  click on layout model icon  select frame tool from tool pallet .  select Repeating frame tool and drag it on frame in report editor area.  select Text tool from tool pallet and drop it on editor area for a labels.  here  text1 –deptno  text2—danme  text3—loc  select Field tool from and drop it on report editor area for report fields. here take  Field1—deptno  Field2—dname  Field3--loc
    •  Right click on filed(Deptno) and select Property pallet  Node—Field  source—deptno  Repeat the similar steps to other fields.  Run the Report but we will get error. Repeating invalid group :  close the error Note:-And click on Layout model icon I object Navigator. Forget layout editor.  Select the repeating frame and right click and go property pallet.  Node--Repeating frame  source—G_dept(this is the master group name) Run it see the result. Create one group for detail group Here also  name of the in Detail Group  Query object to Q_Detail  Group to G_Detail  Create relationship master and detail group through data link.  Go layout model.  add all field which are in detail group  do same job for all the fields  select repeat frame for detail block fields for separately.  run report
    • Note:-  Here we will get error.  remove all fields from repeat frame and frame also.  create new frame for detail block in repeat frame of master.  create one repeat frame with in the new frame.  create a fields for detail group.  attaché all corresponding source columns to these fields.  go property of repeat frame of detail group repeating frame  select the repeating frame(which having all detail fields) and right  select property pallet. Node--Repeating frame source—G_detail(this is the detail group name) run report. go to property of detail repeating frame  Node—General layout  Vertical Elasticity –Expand Run and see go to property of detail filed  Node—General layout  Vertical Elasticity –Expand
    • A parameter is a variable whose value can be set at runtime (e.g, from the Runtime Parameter Form or the command line). There are two types parameters 1)User parameters are created by you for the report. 2)System parameters are created by Report Builder. Note:-  We can delete or rename a user parameter  we cannot delete or rename a system parameter.  expand the Data Model node in the object navigator.  Go to User Parameter node.  select user parameter node and click on the Create Button Button to create a user parameter for passing deptno. Note:-  Default name of parameter is P_1 will be created  Go to property of Queries at object Navigator Navigator (I.c Q-emp) Select the Node—Query Sub Node—SQL Query Statement Click on SQL Query Statement. In select statement Give a parameter as: SELECT Empno, Ename, Sal FROM Emp WHERE Deptno=:a -------- Here ‘a’ is parameter. If we want two parameter the give the two parameter SELECT Empno, Ename, Sal FROM Emp WHERE Deptno=:a AND Sal>:b;
    • Note:- Here we can fined two parameter(I.c A,B) in user parameter object.  Expand the user parameter object for find parameters. Creating Computed columns:-  Computed columns calculates values based on PL/SQL expression or on data provided by database columns.  There are two types of computed columns that can be added to a report. Formula Column:-  It compute their values using PL/SQL expression.  It can operate on multiple values per record. (eg:-sal+comm). Steps:- Summaries Columns:-  It compute their values using built in functions of Oracle Report.  It on one value over multiple records. (eg:-sum of sal amount). Deleting Default Header and Inserting Report Header:  select default marked text and press delete key.  click on text item on the vertical tool bar and place it in the header. (enter the name of company and address.) Additional Default Layout Tool:- It is used to enables default layout for portion of our report with out overwriting enter layout model. How to add date ,time, page number columns:
    •  It is dimensional repot.  A matrix report is a summary report that presents the desired data with headings across the top and the left side.  Used for analysis.  Report format is  Matrix or Matrix with group.  Matrix report is also referred to as “CROSS-TAB”.  A matrix report is a cross-tabulation of four sets of data. 1) One set of data is displayed across the page. (I.e Values are placed one besides other.) 2) One set of data displayed down the Page. (I.e Values are placed one below the others.) 3) One set of data is the cross-productwhich creates data cells at the inter-section of cross and down the data. 4) One set of data is displayed as the ‘filler’ of the cells. (I.e the values are use to fill the cells created step3.)  Open report builder  create one group in data model. >select emp.empno,emp.deptno,dept.loc from emp,dept where dept.deptno=emp.deptno  bring out the data column from group
    • =>Pl/sql constructs can be used to perform if conditional Logic can require in report. 1)Report trigger. => It is enables execution of pl/sql functions at specific times during the execution and formating of a report. There are different type of triggers are available in oracle reports. 1) Formula Triggers. 2) Format Trigger. 3) Action Trigger. 4) Validation Trigger. 5) Report Trigger. 6) Group Filter. 1)Formula Triggers:- Formulas are PL/SQL functions that populate formula or placeholder columns. Access:- You can access the PL/SQL for formulas via: 1) Object Navigator. Nag:-groupfield (cf_tol_salcomm)  PL/SQL Editor (F11) 2)The program unit editor step:-  go to program unit  Select the formula function nameF11 3)column property pallet. Step:- go column property (sal) placeholder/formula—click on node button
    • The program unit editor step:-  go to program unit  RC on program unit select program unit editor. 3)column property pallet. Step: go column property (sal) node—advanced layout sub node– format trigger Note:- The value returned by the formula trigger is displayed In the report field connected to the formula column. Example:- Function CF-salcomm_valueFormula Return Number is Begin Return :sal+nvl(:comm,100); End; Function CF-sales_valueFormula Return Number is Begin Return :avg_product_rate*:sum_quantity; End;
    • 2)Format Trigger:-  This trigger are PL/SQL functions executed before an object is formatted.  The trigger can be used to dynamically change the formatting attributes of objects. Ex:- 1)Font,Font weight etc Access:- 1)OB 2)PL/SQL program unit 3)Layout Object Property. (Main SectionBodyselect Field PL/SQL Editor(F11)) Example:-  A conditionally print or not print a report column value.  Format trigger returns Boolean values TRUE or FALSE.  If the return value for the format trigger is FALSE,the value is not displayed in the report. Requirement:- Display sal above 3000 Steps:-  create report  go filed in Main selectBodyselect filed (I.c sal)  Go to PL/SQL Editor
    •  It is a Report Package which keeps the Report Buit_Ins.  SRW is used as prefix with Buit_ins SRW.message(<NO>,’Msg’); Nouser number. function F_SALFormatTrigger return boolean is begin IF :SAL>3000 THEN SRW.MESSAGE(100,'THSI REPORT IS USED TO DISPALY ONLY ABOUE 3000 SAL ONLY'); return (TRUE); ELSE RETURN(FALSE); END IF; end; How to hiding value:- function F_ename return boolean is begin if :ename not in ('SMITH','WARD','JONES') then return (true); else return (false); end if; end;
    • Create 4 parameters three for ‘emp_ names’ and one for conditional ‘job’ function F_SALFormatTrigger return boolean is begin if :ename in(:NAME1,:NAME2,:NAME3) AND :SAL>:P_SAL then return (true); else return (false); end if; RETURN(TRUE); end; function F_SALFormatTrigger return boolean is begin if :sal >:p_sal then srw.message(100,'the sal is below'||:p_sal); --it is used dispaly message srw.set_foreground_border_color('red'); --it used fill colour round border srw.set_border_pattern('solid'); --draw brower round the value cell. srw.set_foreground_fill_color('magenta'); srw.set_fill_pattern('solid'); --it is used set colour for cells. end if; return (true); end;
    • 3)Action Trigger:-  Action Trigger are PL/SQL procedures executed when a button is select into the previewer.  The trigger can be used to dynamically call another report or execute any other PL/SQL. Access:- 1)OB 2)PL/SQL program unit 3)Button Object Property pallet.  SRW.RUN_REPORT is used in the PL/SQL for a button,  Runtime Parameter Form will not appear by default when the button is selected.  Runtime Parameter Form to appear PARAMFORM=YES in the call to SRW.RUN_REPORT(C:krishnaatrigger.rdf PARAMFORM=no p_job=“MANAGER" PSAL=“3000”); 4) Validation Trigger:-  Validation Trigger are PL/SQL functions that are executed when parameter values are specified on the command line when you accept the runtime parameter form.  Validation triggers are also used to validate the initial value of the parameter in the parameter property pallet. Access:- 1)OB 2)PL/SQL program unit 3)parameter Property pallet. Note:- 1)The PL/SQL in a validation Trigger can be a maximum of 32 K character.  Generate report  accepts ‘mon’ name from user if any employee joined in that month display output if not Give error message
    • ‘There is no employees in this month’  The cursor has to go same parameter filed only. Steps:- 1) Create one report 2) Create one parameter p_mon 3) Go to property of parameter  Uncheck the check box (I.c Restrict List to predetermined values) 4) Click on validation trigger property to define a validation trigger. 5) Write the code here. function P_monthValidTrigger return boolean is s_mon varchar2(20); begin select distinct to_char(hiredate,'mon') into s_mon from emp where to_char(hiredate,'mon')=:p_mon; return (TRUE); exception when no_data_found then srw.message(100,'There is no employees in this month'||:p_mon||'.'); return(false); end;
    • 5) Report Trigger:-  Report triggers execute PL/SQL functions at specific times during the execution and formatting of your report. Note:- We cannot create new global report triggers.  Report Builder has five global report triggers. 1) Before parameter Form trigger 2) After parameter Form trigger 3) Before Report 4) Between Pages 5) After Report Note:-  Any processing that will effect the data retrieved by the report should be performed in the before form or after form trigger. 1)Before parameter Form trigger:-  Fires before the report is executed but after queries are parsed and data is fetched. function BeforePForm return boolean is begin IF USER='SCOTT' THEN return (TRUE); ELSE SRW.MESSAGE(100,'Permisition Denied........'); return(FALSE); END IF; end;
    • 2) After parameter Form trigger:-  Fires after you exit the previewer, or after a report output is sent to a specified destination. function AfterPForm return boolean is cnt number; begin select count(*) into cnt from emp where deptno=:dno; IF cnt>=5 THEN return (TRUE); ELSE SRW.MESSAGE(100,'It has a less employees........'); return(FALSE); END IF; end; Use Report triggers to store the name of the user who execute the report,the date on which the report was execute:- Step1:- Create a table for store user,date. Column name:-- User_Name varchar2(40) column name:- Report_Date Date Create table user_date(User_Name varchar2(40), Report_Date Date);
    • Trigger after parameter form function AfterPForm return boolean is user_name varchar(10); begin select user into user_name from dual; insert into user_date values(user_name,sysdate); srw.message(100,'the user'||user_name||sysdate); return (TRUE); end; Note:- Toolspreferences. function AfterPForm return boolean is begin if :p_job is null and :p_sdate is null and :p_edate is null then :p_job:='%'; :p_sdate:=trunc(sysdate,'mm'); :p_edate:=sysdate; return (TRUE); else return(true); end if; end;
    • 1. Before Parameter Form trigger is fired.  Runtime Parameter Form appears(if not suppressed). 2. After Parameter Form trigger is fired (unless the user cancels from the Runtime Parameter Form).  Report is "compiled."  Queries are parsed. 3. Before Report trigger is fired.  SET TRANSACTION READONLY is executed (if specified via the READONLY argument or setting). 4. Between Pages trigger fires for each page except the last one.  COMMITs can occur during this time due to any of the following--user exit with DDL, SRW.DO_SQL with DDL, or if ONFAILURE=COMMIT, and the report fails.  COMMIT is executed (if READONLY is specified) to end the transaction. 5.After Report trigger is fired. 11 COMMIT/ROLLBACK/NOACTION is executed based on what was specified via the ONSUCCESS argument or setting. 3)Before Report:-  It fires before the report is executed but after queries are parsed and data is fetched. Requirement:-  If enter the max rows through parameterthen it will display only that many rows only.  If we not enter enter any parameter it will display all records.  The report query is execute after triggering the BEFORE REPORT trigger.  Thus the maximum number of rows fetched can beset by using SET_MAXROW() procedure in the BEFORE TRIGGER (Or) procedure sets the maximum number of records to be fetched for the specified query.
    •  Query statement is select empno,ename,sal from emp order by sal desc function BeforeReport return boolean is begin if :p_cutoff is not null then srw.set_maxrow('Q_1',:p_cutoff); return (TRUE); else return(true); end if; end; Q_1Query name. :p_cutoff it is parameter name. Placeholder Columns:- It act as global variables in the Data Modal.A placeholder is a column for which you set the Data type and value in PL/SQL that you define. You can set the value of a placeholder column in the following places: The Before Report Trigger, if the placeholder is a report-level column A report-level formula column, if the placeholder is a report-level column A formula in the placeholder's group or a group below it (the value is set once for each record of the group)
    • Place holder is write at Before Report 10 MANAGER 20 CLERK 30 SALEMAN Go to user parameter (Dno)  Click the Place Holder and write the program. In Query Select empno, ename, job, deptno From emp Where job=:cp_1 Note:-  In case of placeholder column no need of create a parameter for :cp_1,we can create a place holder column in out of the group. We can reference as parameter(:cp_1). 2)In case before parameter form it is not possible. Go to Before Report function BeforeReport return boolean is begin IF :DNO=10 THEN :cp_1:='MANAGER'; ELSIF :DNO=20 THEN :CP_1:='CLERK'; ELSIF :DNO=30 THEN :CP_1:='SALESMAN'; END IF; return (TRUE); end;
    • 4) Between Pages Trigger:-  It fires before each page of the report formatted, except the first page.  This trigger can be used for customizing page formatting.  It can be used to pass printer codes to supports changing page orientation in the middle of a report.  You can use this trigger to send specific control character to the printer to change the paper orientation or to do double-sided printing. 5)After Report:-  This trigger fires once after the report is successfully executed.  It is used to send a message of Successfully report completion as well as to pass back the last page number in a multi_page report. 6)Group Filter:-  It determines which records to include in a group.  You can use packaged filters, First and Last.  The FRIST,LAST used to display the first n or last n records for the group. (or)  you can create your own filters using PL/SQL. Write the program Group filter trigger at group :- function filter_comm return boolean is begin if :comm IS NOT NULL then if :comm < 100 then return (FALSE); else return (TRUE); end if; else return (FALSE); -- for rows with NULL commissions end if; end;
    • Example for Group Filter:- function G_dnameGroupFilter return boolean is N NUMBER; begin SELECT COUNT(*) INTO N FROM EMP WHERE ENAME IS NULL AND SAL IS NULL AND COMM IS NULL AND DEPTNO=:DEPTNO; IF N=0 THEN RETURN(TRUE); ELSE return (FALSE); END IF; end;
    •  Go to program unit  create a packagespecification Give name emp_deptno_update PACKAGE emp_deptno_update IS type r_comp is record (deptno emp.deptno%type, ename emp.ename%type, hiredate emp.hiredate%type, sal emp.sal%type, total_sal emp.sal%type); TYPE comp_rc IS REF CURSOR RETURN r_comp; FUNCTION emp_sal( p_deptno NUMBER) RETURN comp_rc; END; Package body:- PACKAGE BODY emp_deptno_update IS FUNCTION emp_sal( p_deptno NUMBER) RETURN comp_rc IS c_emp emp_deptno_update .comp_rc; v_raise NUMBER; BEGIN IF p_deptno>=40 THEN v_raise :=1.4; ELSIF p_deptno=30 THEN v_raise :=1.3; ELSIF p_deptno=20 THEN v_raise :=1.2; ELSE v_raise:=1.1; END IF;
    • OPEN c_emp FOR SELECT deptno,ename,hiredate,sal, v_raise*(sal+nvl(comm,0)) total_sal FROM emp WHERE deptno=p_deptno ORDER BY ename; RETURN c_emp; END; END; create a one user parameter NameP_deptno draw out a REF CURSOR query in the data model. writer a function that returns the cursor variable that runs the database function. function emp_deptno_RefCur return emp_deptno_update.comp_rc is begin RETURN emp_deptno_update. emp_sal(:P_DEPTNO); end; Lexical Parameter:-  Lexical references are placeholders for text that you embed in a SELECT statement.  Lexical references to replace the clauses appearing after SELECT, FROM, WHERE, GROUP BY, ORDER BY, HAVING, CONNECT BY, and START WITH.
    • How to create user define exceptions. EXCEPTION when SRW.MAXROW_INERR then srw.message(1000, 'Contact Oracle''s customer support: SRW.MAXROW_INERR'); raise srw.program_abort; Anchors:-  Anchors are used to determine the vertical and horizontal positioning of a child object relative to its parent.  The end of the anchor with a symbol on it is attached to the parent object..
    • A Graph is a form of information representation, It is used to visually display a lot of information in a Compact form. Chart Types:- 1) Column:-  Column charts type is used to compare sets of data Ranges vertically. 2) Bar:-  Bar Chart type is used to compare sets of data Ranges horizontally. 3) Line:-  line chart type is used to show vertical changes for a specific set of data. 4) Mixed:-  Mixed chart combines multiple plot types such as column and line. 5) Double-Y:-  Double Y chart type provides two independent Y-axes On which to plot data.each Y-axis can show a different range of values. Ex:-one axis can be used to represent no of employees and the second axis can be used to represent emp sal For a specific year. 6) Pie:-  This type chart is used to compare the ratios or percentages of parts of a whole. Ex:- a pie chart can be used to compare total Sal by Deptno. 7) Table:-  Table chart type is used to show data in a Table format. 8) Scatter 9)High_low 10) Gantt:-  Gantt chart type is used to show sets of Project data over a given amount of time.  Gantt charts are generally used to show project milestones timelines. Ex: - a pie chart can be used to compare total Sal by Deptno.