Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

10g forms


Published on


Published in: Education, Technology
  • my mail id is can anybody send me dis books oracle forms and reports
    Are you sure you want to  Yes  No
    Your message goes here
  • very effective
    Are you sure you want to  Yes  No
    Your message goes here
  • thanks so much
    Are you sure you want to  Yes  No
    Your message goes here

10g forms

  1. 1. Oracle 10g Forms This book belongs to Name :______________________________________ Batch :______________________________________ SQL Star International Ltd. SQL Star House, No. 8-2-293/174/A 25, Road No. 14, Banjara Hills, Hyderabad - 500 034, Andhra Pradesh, INDIAConfidential © SQL Star International Ltd. 1
  2. 2. Copyright © 2008 Second Edition SQL STAR INTERNATIONAL LIMITED SQL Star House,8-2-293/174/A25, Road No.14, Banjara Hills, Hyderabad - 500 034. Tel. No. 91- 40-23101600(30 lines) Fax No. 23101663 Toll Free No: 1800 425 2944 Email: info@sqlstar.comNo part of this publication may be reproduced (incl. photocopying) in any way, withoutprior agreement and written permission of SQL Star International Ltd., Hyderabad. SQLStar International Ltd., Hyderabad assumes no responsibility for its use, nor for anyinfringements of patents or other rights of third parties which could result.Confidential © SQL Star International Ltd. ii
  3. 3. Table of contents 10g FORMS CHAPTER CHAPTER TITLE PAGE No. NO 1. Introduction to Oracle Forms Developer Suit 1 – 12 2. Running a Forms Developer Application 13 – 25 3. Forms Developer Interface 26 – 39 4. Basic Form Module Creation 40 – 65 5. Discuss Data Block Properties 66 – 77 6. Creating Text items, LOVs and Editors 78 –100 7. Creating Input and Non-Input Items 101-126 8. Windows & Canvases 127-142 9. Triggers 143-167 10. Item InteractionTriggers and Alerts 168-193 11. Item Validation and QueryTrigger 194-213 12. Navigation 214-228 13. Key & Mouse Event Triggers 229-249 14. Transaction Triggers 250-263 15. Flexible Code 264-275 16. Sharing Objects and Code 276-292 17. WebUtil for Client Interaction 293-308 18. Working with Multiple Form Applications 309-340 19. Managing Menus 341-372Confidential © SQL Star International Ltd. iii
  4. 4. Chapter 1 Introduction to Oracle Forms Developer Suite Introduction to Internet Computing Products Grid computing Oracle10g Tools for Forms development Oracle10g AS Architecture Oracle10g Provides Oracle Forms Services Benefits of Oracle10g Developer Suite What Is Oracle Forms Developer© SQL Star International Ltd 1
  5. 5. ObjectiveAt the end of this chapter, you will be able to: • Get a brief idea about Internet Computing Products • Understand Grid Computing • Learn the components of the Oracle10g Application server • Know what Oracle10g Provides • Describe the features and benefits of Oracle Forms services and Oracle Forms developer • Gather information about the benefits of Oracle10g Developer Suite • Know all the features of Oracle Forms DeveloperConfidential © SQL Star International Ltd. 2
  6. 6. Introduction to Internet Computing ProductsInternet is the most preferred media to publish information for the masses.Oracle Corporation has come up with a wide range of different tools, which istargeted at different audience for the development work.Based on the nature of work requirement, you can choose from the pool of Oracleproducts. Different products have been developed for different kind of audiences.Some of the categories of audiences who can use them are:Enterprise application developers:The apt Oracle product for audience belonging to this category would be OracleDesigner and Oracle Forms Developer. • Oracle Designer: This Oracle modelling tool helps to collect the business requirement by giving support to SDLC process. • Oracle Forms Developer: It is a wizard based Rapid application development tool through which Internet based powerful applications can be developed within a short span of time. Deployment of the application is made easier with Form Services, which is an Oracle Application server component.Java Component Developers:If you were a Java developer, then the suitable product of Oracle would beJdeveloper. • Jdeveloper: It is a single Oracle’s java development environment, providing necessary tools for developers working in Java and Web services projects. It covers the full development lifecycle from design through coding, debugging and tuning till deploying the application.Website developers:These developers are mainly those, who see Internet as the only media to workwith, in order to publish their information. Oracle has come up with Oracle portalkeeping these developers in mind. • Oracle Portal: It is a complete integrated framework used for developing and deploying application of enterprise portal. It tightly resides inside Oracle10g database.MIS Developers: Oracle business intelligent toolset has helped MIS developers to create reports which help the management to make mission critical decisions. This toolset also contains a product, which can be used by the end user to generate day- to-day reports. Oracle business intelligent toolset comprises the following products, which provides a whole range for reporting, analysis, and trending facilities: • Oracle Reports Developer • Oracle Report services • Oracle Discoverer • Oracle ExpressConfidential © SQL Star International Ltd. 3
  7. 7. Grid ComputingThe database systems such as Relational, Hierarchical and Network have beensuccessful in developing the database for traditional business applications such asBanking and Railway reservations. But, when it comes to more complex businessapplications such as databases for scientific work, engineering designs,telecommunications, geographic information system and multimedia, thetraditional database systems cannot handle them because the requirements andcharacteristics of these applications are different from the traditional businessapplications. These applications require more complex structures for: • Storing data related to real world objects such as engineering diagrams, molecular structures, or financial instruments. • Transactions, which would be for longer durations. • New datatypes required for storing complex multimedia data such as audio and video clips, images and maps.Oracle10g Database meets the above needs as it tightly incorporates ORDBMSconcepts.Object Relational Database Management System (ORDBMS) is a databasemanagement system that has evolved from the relational model and includesboth the relational and object oriented technology. Oracle8.0 was the first versionof the Oracle database to incorporate object-oriented technology.In Oracle10g, ‘g’ stands for GRID. This release is focused on efficientmanagement of infrastructure based on its grid computing mechanism.Now, the question arises what is Grid Computing?Grid computing provides clustering of remotely distributed computing.The idea behind grid computing is to utilize the resources available to themaximum extent, by dynamically pooling it based on the requirement of the enduser during the peak hours. In this case, the end user need not know thewhereabouts of the resource.Oracle grid infrastructure products: • Oracle Database 10g • Oracle Application Server 10g • Oracle Enterprise Manager 10g Grid ControlOracle Database 10gOracle10g database supports Grid Computing architecture. Here, multipledatabase servers are pooled together to form a cluster. It enhances utilization ofresources. It efficiently stores and manages the structured and unstructured datasuch as: • Spreadsheets • Word documents • PowerPoint presentations • XMLConfidential © SQL Star International Ltd. 4
  8. 8. • Multimedia data types like MP3, graphics, video and more.Oracle 10g facilitates two-tiered or multi-layered distributed databaseenvironments like client/server and Web-based applications. Large objects needbe stored inside and outside the database. Oracle Database 10g have serviceswhich help to manage and retrieve data, located outside the database.• Oracle Application Server 10gA complete infrastructure platform is provided for developing and deployingenterprise applications, integrating many functions including a J2EE and Webservices run-time environment, an enterprise portal, an enterprise integrationbroker, business intelligence, Web caching, and identity management services.The existing 10g AS gets further enhanced with the introduction of new gridcomputing features. It further integrates users, applications and data across yourorganization.• Oracle Enterprise Manager 10g Grid ControlIt is the consolidated, core management console that forms the basic frameworkto automatically initiate administrative tasks across the networked environment.With Oracle Grid Control, multiple hardware nodes, databases, application serversand other targets can be brought together into single logical entities.Oracle10g Tools for Forms developmentOracle10g release can be broadly divided into 3 categories.Oracle Database: It supports ORDBMS, managing unstructured and structuredinformation efficiently. It follows the concept of re-usability there by promotingautomation techniques.Oracle10g Application Server (Oracle10g AS): It forms the middle tier whichholds a range of Business Logic Application, developed in different platforms suchas JAVA, PORTAL, FORMS, WAP and business intelligence. Forms Services, themain component of Oracle10g AS play an important role in deploying the formsapplication on to the Web-based environment.Oracle10g Developer Suite (Oracle10g DS): It comprises Oracle applicationdevelopment tools and Oracle Business Intelligence tools. This product forms acomplete package for developing scalable, re-usable and reliable application to beshared across the web environment.Oracle10g AS ArchitectureLooking into the functional structure, this architecture can be divided into: • Communication Services: Manage the request/response of/for a client, by means of suitable protocols. • Application Runtime Services: It contains J2EE Container that forms a common runtime environment for Applications developed as JSPs, Servlets, EJBs and Web Services. • System Services: It provides a similar group of runtime services required by the web based application for managing their essential processes such as request dispatch and scheduling, resource pooling, clustering, fault monitoring, transaction management and messaging.Confidential © SQL Star International Ltd. 5
  9. 9. • Management Services: These services record the status, monitor the performance and handle the failure of the system. It helps to keep track of the resource consumption, manage multiple instances and support single sign-on feature. • Connectivity Services: Enables connectivity between systems of different platforms. • Solutions: A comprehensive set of solutions all built on the infrastructure described above, including Enterprise Portals, Enterprise Integration, Business Intelligence, Wireless and ISV Solutions. Oracle10g AS ArchitectureList of Oracle10g Application Server Components and their functionality: • Extract and analyze business intelligence: Clickstream, Personalization, Reports Services, Discoverer. • Integrate your business: Interconnect, Workflow, Unified Messaging, Internet File System. • Create personalized portals: Oracle10g AS Portal. • Deploy dynamic Web applications: XDK, Web Services, Forms Services, OC4J, HTTP Server. • Manage and secure your Web infrastructure: Enterprise Manager, Security, and Internet Directory.Oracle10g AS provides: • A Comprehensive and a fully integrated platform for deploying web applications. • Facilities to redefine the business process and publish them into the enterprise portal, which can be accessed from the internet or wireless services. • Forms Services, a component in it that deploys the application on to the web.Confidential © SQL Star International Ltd. 6
  10. 10. • Provides web cache which enhances the performance and throughput of the website by caching mechanisms. • Manage and secure your Web infrastructure by Single Sign On (SSO) method.Oracle Forms ServicesOracle Form Services is a component of the middle tier, Oracle10g AS. It isresponsible for deploying Oracle Forms Developer applications in a multi-layeredenvironment without compromising the functionality and the intricacies of theinterface. It provides the required infrastructure through its in-built services.Oracle Forms Services uses a three-layered architecture to deploy applicationsover the web. These include: • A Java enabled thin client tier, where the application’s output is presented by the interface to the user. • The middle tier is the application server or servers, where the application logic and server software reside. • The database tier is the database server or servers, where enterprise data is stored. Oracle10g Forms Services Forms Services ArchitectureForms Services consists of four major components: the Java client (Forms Client),Oracle Jinitiator, the Forms Listener Servlet, and the Forms Runtime Engine. Youwill learn about these components in chapter 2 - Running a Forms DeveloperApplication.Process at the client end: 1) Oracle Jinitiator is downloaded on the very first request of the client. This forms the surface for running the applications. 2) An applet is dynamically loaded into the client machine and cached.Confidential © SQL Star International Ltd. 7
  11. 11. The Forms Listener Servlet and Forms Runtime Engine process on the middle tierof Oracle10g As.Benefits of Oracle10g Developer SuiteThe Oracle10g Developer Suite: • Provides a complete integrated set of tools for developing web-based applications. • Helps to develop Internet compatible Web services applications using Java and XML. • Produces performance based tuned application, by utilizing the resources of both Oracle Database and Oracle application server to its maximum.Confidential © SQL Star International Ltd. 8
  12. 12. • Further, enhances the richness of the application by incorporating capabilities for Microscopic analysis of data and distributing the same, across the web.Based on the toolset availability, Oracle10g developer suite can be divided into: 1. Application Development tools Oracle Designer: Used for reverse engineering and code generation. Forms Developer and Jdeveloper: Used for Rapid Application development (RAD) of enterprise application and business components for Java respectively. J2EE and Web Services: Extends support for latest J2EE 1.2 API’s, including Enterprise JavaBeans (EJB), Java Server Pages (JSP) and Servlets 2.3. Integrated web services support for SOAP (simple object access protocol) and WSDL (web services definition language) Software Configuration Manager (SCM): Used to keep a record of version changes, impact of renewed configuration, parallel development and analyzing dependencies among objects. 2. Business Intelligence Reporting Tools Oracle10g Warehouse Builder: Follows a fixed process of extracting, transforming and loading data. It reduces the complexity of designing and managing the warehouse and data mart, web based business intelligence application by providing easy GUI driven data mapping, pre-defined transformation tools and creating dimensional data by drag-drop features. Oracle10g Discoverer Administrator: Provides a collection of data of business importance, neatly managed by the system manager of the BI tools. It allows ad-doc query and analysis on these related data performed on the Discoverer clients, which are Oracle10g AS Discoverer Plus, Oracle10g DS Discoverer Desktop, and Oracle10g AS Discoverer Viewer. Oracle10g Reports Developer: Reports can be created with easy wizard driven GUI tool. It allows the developer to create reports by taking maximum control over the various data sources available and utilizes a wider media to publish the same.What is Oracle Forms Developer?It is a front-end tool used to develop enterprise-driven applications with its GUIcapabilities. Powerful web based interface applications can be rapidly developeddue its re-entrant wizard features. It tightly integrates with the Oracle10gDatabase for building up its application. It can also embed java components,increasing its developmental capabilities further.Applications can be developed on the basis of code generation and reverseengineer modeling features of Oracle Designer. Hence it works hand in hand withOracle Designer.Oracle10g Forms Developer: Key FeaturesTools for Rapid Application Development:Confidential © SQL Star International Ltd. 9
  13. 13. Database forms and business logic can be created with minimum effort. WizardandBuilt-in subprograms are responsible for quick development of application.Application Partitioning:PL/SQL program units can be created both in the back-end i.e. database server aswell as in the front on i.e. Oracle Forms. It is because of the separate PL/SQLengine present in both the environments. When needed, this business logic canbe moved between the modules and Oracle10g database.Flexible Source Control:Oracle10g Software Configuration Manager (SCM) is integrated directly in FormsDeveloper, used to keep a record of version changes, impact of renewedconfiguration, parallel development and analyzing dependencies among objects.Extended Scalability:The multi-layered environment allows the product to be distributed among a widerange of users with no further manipulation in the application.Object Reuse:It enables centralization of code and pooling of reusable objects by creatingPL/SQL libraries and object libraries, linking the object behavior of differentmodules by inheritance and subclassing mechanism.Confidential © SQL Star International Ltd. 10
  14. 14. SummaryIn this chapter, you have learnt that: • Various Oracle products have been developed for accommodating the needs of different kinds of developers. For example, a suitable product of Oracle for a Java developer would be Jdeveloper. • Grid computing provides clustering of remotely distributed computing. • Oracle Database supports OORDBMS, managing unstructured and structured information efficiently. • Oracle10gAS architecture can be divided into: Communication Services, Application Runtime Services, System Services, Management Services, Connectivity Services and Solutions. • Oracle Form Services is a component of the middle tier, Oracle10g AS that is responsible for deploying Oracle Forms Developer applications in a multi-layered environment. • The Oracle10g Developer Suite benefits you by providing a complete integrated set of tools for developing web-based applications and many more. • Oracle10g developer suite can be divided into Application Development tools and Business Intelligence Reporting tools. • Oracle Forms Developer is a front-end tool used to develop enterprise- driven applications with its GUI capabilities. • Key Features of Oracle10g Forms Developer are tools for Rapid Application Development, Application Partitioning, Flexible Source Control, Extended Scalability and Object Reuse.Confidential © SQL Star International Ltd. 11
  15. 15. Exercise1. What do you understand by Grid Computing?2. What are the different Oracle 10g tools for Forms Development?3. Explain briefly about Oracle Forms Services.4. What are the different Reporting Tools?5. List out the key features of Oracle10g Forms Developer. Confidential © SQL Star International Ltd. 12
  16. 16. Chapter 2 Running a Forms Developer Application Introduction to Three-tier Architecture Testing a Form Java Runtime Environment Starting a Run-time Session Form Application in a Web Browser Oracle Environment variablesConfidential © SQL Star International Ltd. 13
  17. 17. ObjectiveAt the end of this chapter, you will be able to: • Define the three-tier architecture • Get the solution of how to test a Form • Learn the concept inside Java Runtime Environment • Describe Starting a Run-time session • Understand about various Form application in a web browser • Know about some Oracle environment variablesConfidential © SQL Star International Ltd. 14
  18. 18. Introduction to Three-tier ArchitectureWe are now aware that Form Services, a component of Oracle10g AS helps todeploy applications in a multi-layered environment. But how does this componentactually work?This chapter helps us to explore its functionality in detail.A three-tier Architecture would look something like this: Application Server Database Three-tier EnvironmentLet us now discuss the different entities of the architecture individually in detail:Forms Client:It includes a thin Java applet embedding all types of Oracle forms application,which runs within the boundaries of client’s Java enabled web browser. This isalso known as thin client as no application logic or enterprise data is stored by it.It is responsible for: • Displaying user-interaction screen encoded in the application. • Acting as a single point user-interface to accept the requests. • Behaving like an acceptor to receive the responses given by the form services.Application Server:It is the middle tier where the application logic and the main component fordeployment, the Form Services reside. All processing related to application isdone here.Confidential © SQL Star International Ltd. 15
  19. 19. Application ServerThe main components that reside inside the form services of the ApplicationServer are:Forms Listener Servlet: It is a complete Java Servlet that runs in the middletier, which works in close proximity with Oracle HTTP Server or OC4J (OracleApplication Server Container for J2EE).Responsibilities include: • Accept request given by the client for initiating connectivity. • It either invokes a new runtime engine or is allocated a previously running runtime engine from the runtime engine pool. • Acts as a communicating agent between the client and the runtime engine.Forms Servlet: It generates an HTML page to be downloaded on to the client,based on the web configuration file (formsweb.cfg), base HTML file (basejini.htmor base.htm or baseie.htm) or application’s URL parameters.Runtime Engine: It is an ifweb90 processor initialized by forms listener servletin the middle tier.Responsibilities include: • Managing the processing of application logic. • Maintaining an uninterrupted connection to the database on behalf of the client.Oracle10g Database: It is the third tier where enterprise data is stored.Confidential © SQL Star International Ltd. 16
  20. 20. Testing a Form: Starting Oracle Application ServerContainers for J2EE (OC4J)Oracle Application Server containers for J2EE (OC4J) is preferred to run Formsapplications. • Included in Oracle10g DS to enable testing. • On NT, run batch file to start OC4J.Starting OC4JOracle10g AS Containers for J2EE (OC4J) is Oracle’s Java 2 Enterprise Edition(J2EE) container that executes on any Java Virtual Machine (JVM), the Javainterpreter that is provided on each operating system and hardware platform. Itis implemented completely in Java, making it lightweight and easy to install. Atthe same time, it provides complete support for J2EE applications, includingServlets, Enterprise JavaBeans, Java Server Pages, and so on.OC4J is ideally suited to run Forms applications. It is included in Oracle10gDeveloper Suite to enable you to test your applications, if desired, on the samemachine where you are running Forms Builder. In other words, you do not needto install Oracle10g AS to test your applications.To use OC4J on Windows NT, you start it by executing the provided batch file,called startinst.bat. This file is located in the j2eeOracle10gDS subdirectory ofORACLE_HOME. If you will be testing your applications on your client machine,then it is a good idea to set up a shortcut to startinst.bat batch file and alsostopinst.bat batch file to start and stop the OC4J instance respectively.The batch file executes in a separate window. (You can minimize this window ifdesired). Do not close this window, or you will abort the OC4J instance.When you no longer need to run OC4J, you can execute the batch file to stop theOC4J instance, called stopinst.bat.Confidential © SQL Star International Ltd. 17
  21. 21. Testing a Form: The Run Form Button With the Run Form Menu command or Button , you can : - Run a form from Forms Builder - Test the form in a three-tier environment The Run Form command takes its settings from Preferences ; - Edit -> Preferences - Runtime tab - Set Application Server URL to point to Forms Servlet - Set Web Browser location if desired – of a FormIn order to run the application in a web browser, the user’s request should be inthe form of a URL. This URL is written in the address bar of the web browser. Thesyntax of the URL would be similar to the following format:http://domain[:port]/forms servlet or html file [parameter]Where,http: ProtocolDomain: Server name where the application resides.Port: Default for HTTP server 8889 default for OC4JFormsServlet: /forms/frmservletParameter: indicates form, userid=username/password@databaseJava Runtime EnvironmentIn order to deploy the forms application on to web browser, it is necessary tohave a Java runtime environment. On windows platform, Java RuntimeEnvironment (JRE) can be created by Oracle Jinitiator, a plug-in supplied byOracle, which enables the end user to run Oracle forms developer directly on thebrowser that does not provide a JRE environment. It is automatically downloadedto a client machine from the application server.Benefits: • It caches the Java archive files on the client thereby helping reduce the application startup time. • It provides applet instance caching. This is a method of storing the running form application during navigation event. When the userConfidential © SQL Star International Ltd. 18
  22. 22. returns to the same page, the cached page is restored. This improves the application performance.Starting a Run-time SessionGiven below, is a list of processes that occurs: • A request is sent from the client to the application server in the form of URL. • The request is taken up by the Oracle HTTP server or OC4J and passed further to Forms Servlet. In response to it, Forms Servlet creates a HTML page containing all the relevant information for the generation of a forms applet, which is given to the HTTP server. You can see this in the following diagram:Now, HTTP server responds by downloading a generic applet, which is cachedlocally on the client.Forms applet sends a request to the Forms listener to invoke the forms runtimeengine.Confidential © SQL Star International Ltd. 19
  23. 23. • Forms Client cannot interact with the database directly. So here, runtime engine works on behalf of the client. Oracle Forms runtime engine executes the application specified in the URL and then passes the result to the Forms applet via Forms listener. • Forms applet running within the client browser, displays the application as per the application logic. • Once the initial request to the application is completed, the Forms listener Servlet along with HTTP server handles the communication between the forms applet and the runtime engine.Forms application in a Web browserClient-Server Deployment at RuntimeForms runtime session is started when you run a form module. The componentsof the runtime session are:Confidential © SQL Star International Ltd. 20
  24. 24. • MDI Parent Window: Multiple Document Interface (MDI) parent window is the default window provided to display form modules. MDI window can display multiple form modules. • SDI Window: Form Builder also provides support for a Single Document Interface (SDI) Window even though the default window is the MDI Window. • Default Menu: Oracle Forms Developer provides all applications with a default menu. This menu can be customized to enhance the functionality of your applications. • Menu Toolbar: Menu Toolbar contains icons that correspond to the menu items. It is provided to add functionality and is a short cut to the menu items. • Console: The Console is displayed during runtime at the bottom of your window, which displays information. It also consists of: o Message Line: It displays Form Builder and application specific messages. Database error messages are displayed in the message line. o Status Line: Displays the state of the form module. It will tell you if there is a list of values associated with the item and if the block is in the enter query mode or not. o Data Elements: Irrespective of the deployment the data elements in a Form Builder are same in the Web or in a Client-server environment. The data elements that you see at runtime are: • Boilerplate text • Boilerplate graphics • PromptsConfidential © SQL Star International Ltd. 21
  25. 25. • Text items • List items • Push buttons • Display items • Radio buttons • Check boxes • Image items • Hierarchical tree items • Chart items • Custom items Oracle Developer Environment Variables In order to customize the application, following environment variables can be modified. Forms environment variables for design time UI_ICON_EXTENSIONFORMS_BUILDER_CLASSPATH FORMS_HIDE_OBR_PARAMS Set to FALSE to be able to Set so that forms builder see the hidden parameters can find java class files passed in the URL during development and testing process UI_ICON Type of the iconic image, i.e., gif, jpeg of .ico must To create iconic images in be specified here forms builder, path of the icon is set here Confidential © SQL Star International Ltd. 22
  26. 26. Forms environment variables for runtime FORMS_RESTRICT_ENTER _QUERY FORMS_PATH CLASSPATH Set this parameterGives path of the Form ORACLE_PATH Specifies path of to True to invokebeing searched by Java Class file the Query/WhereForms builder to run it required for Forms dialog box. By default it is set to Specifies the search path False. for files referenced by Reports RuntimeAlternatively, you can control the environment variable setting in file known asformsserverdefault.envConfidential © SQL Star International Ltd. 23
  27. 27. Summary In this chapter, you have learnt that: • How Form Services, a component of Oracle10g AS actually works. • Forms Client includes a thin Java applet embedding all types of Oracle forms application, which runs within the boundaries of client’s Java enabled web browser. • Oracle10g AS Containers for J2EE (OC4J) is Oracle’s Java 2 Enterprise Edition (J2EE) container that executes on any Java Virtual Machine (JVM). • OC4J is ideally suited to run Forms applications. • In order to run the application in a web browser, the user’s request should be in the form of a URL. • Java Runtime Environment (JRE) can be created by Oracle Jinitiator, which enables the end user to run Oracle forms developer directly on the browser that does not provide a JRE environment. • One of the benefits of JRE is that it caches the Java archive files on the client. • Forms Client cannot interact with the database directly. So here, runtime engine works on behalf of the client. • Forms runtime session components are MDI Parent Window, SDI Window, Default Menu, Menu Toolbar and Console.Confidential © SQL Star International Ltd. 24
  28. 28. Exercise 1. What are the main components of Forms Services? 2. What are the different modes of operations? 3. ________ is the default window provided by forms builder. 4. ________ is the default canvas provided by Forms Builder. 5. What are the components of run-time session? 6. What is the default port number in Oracle 10g? 7. Which file is required to start and stop OC4J server? 8. List the forms environment variables available at design time and runtime? 9. _______ gives the path of the Form being searched by forms builder to run it. 10. _______ specifies the path of java class file required for forms debugger. 11. _______ is set so that forms builder can find java class files during development and testing process. 12. _______ path of an icon is set here which is used to create iconic images in the forms builder. 13. Type of the iconic image i.e., gif, jpeg or ico must be specified in _______. 14. In formsweb.cfg change the applet parameter width to 900 and height to600.Confidential © SQL Star International Ltd. 25
  29. 29. Chapter 3 Forms Developer Interface The Form Builder Environment The Form Builder Components The Form Builder Module Types Oracle Form Builder Interface Components Form Module Objects Navigation in a Form Module Master versus Detail Blocks Multi-Block and Multi-Form Applications Library Management ModuleConfidential © SQL Star International Ltd. 26
  30. 30. Objective At the end of this chapter, you will be able to: • Identify and describe forms builder environment • Understand the main components of form builder • Get a brief idea about forms builder interface components • Learn form module objects • Know how navigation takes place in a form module • Find the difference in Master and Detail Blocks • Find the difference in multi-block and multi-form applications • Describe library management moduleConfidential © SQL Star International Ltd. 27
  31. 31. The Form Builder Environment The Form Builder environment allows you to design your form modules and manipulate data in a number of ways. Form Builder enables users to: • Insert, update, delete and query data • Present data using text and images • Present data using JavaBeans and ActiveX custom controls • Manage Forms across multiple windows • Access Oracle Graphics Builder and OLE2 applications • Send data to Oracle Reports BuilderThe Form Builder Components The Form Builder has three executables that help to create, compile and run a form module: Form Builder: It is used to design and build applications and store the definition. It can be invoked using FRMBLD.EXE Form Compiler: It is used to read the definition of the form module and convert them into an executable run file. It can be invoked using FRMCMP.EXE Form Runtime: It is used to execute a form module. Before you want to run a Form, ensure that the form module is compiled.The Form Builder Module Types Form Builder allows you to create four types of modules, which are stored as files. A module owns all the objects that are created within it and is the basis of storage and ownership. The different types of modules in Form Builder are: • Form Modules: These make up the major chunk of your application. In a form module you retrieve and manipulate data that is arranged in the form of records. • Menu Modules: Form Builder enables users to create their own menus. The menu of an application is created and stored in a menu module. Users can customize or replace the default menu provided by Oracle Forms Developer. • PL/SQL Library Modules: This is a collection of all the PL/SQL program units that can be used by other modules in your application. • Object Library Modules: An object library allows you to store objects that you can reference and use in other modules. This feature enables you to create objects and distribute them throughout the organization.Confidential © SQL Star International Ltd. 28
  32. 32. Oracle Form Builder Interface Components The following tools are provided in the Form Builder: • Object Navigator: This is a hierarchical tree structure of the objects used in the application. It is used to locate and manipulate the objects. • Property Palette: All objects in an application including the module have their own set of properties. These properties can be viewed and modified in the Property Palette.Confidential © SQL Star International Ltd. 29
  33. 33. . • Layout Editor: Provides an interface to create and arrange the items and graphical objects in your application.Confidential © SQL Star International Ltd. 30
  34. 34. • PL/SQL Editor: Allows you to develop subprograms in the Oracle Forms Developer and in the database.Confidential © SQL Star International Ltd. 31
  35. 35. Form Module Objects Form modules make up a major portion of your application. They are made up of a large number of objects. A form module comprises the following: • Window: This is the largest object in a form module. Broadly speaking window is nothing but an empty picture frame. All the visual objects are contained within this frame. There are two types of windows: o Document or modeless window o Dialog or modal window • Canvas: A canvas is the interface where items are placed. A window can contain more than one canvas. There are four types of canvases: o Content Canvas o Stacked Canvas o Tab Canvas o Toolbar Canvas • Block: A block is the owner of items in a form; there can be more than one block in a form. All the items in a block are logically related. There are two types of blocks: o Data Blocks: These blocks contain items that are based on the database tables, views, stored procedures, a FROM clause query, or a transactional trigger. o Control Blocks: These blocks are not based on any database tables, but they are created to enhance the functionality of the application.Navigation in a Form ModuleWhen you run a form, you principally navigate by the way of items and blocksand not by canvases. Each item has a sequenced position within its block, andeach block has a sequenced position in the form.When a user requests to move to the next item in a block, focus will be set on thenext item in sequence, no matter wherever that may be. If the next item is on adifferent canvas, Oracle Forms Developer displays that canvas automatically.Similarly, users can request to move to the next block (or previous block). If thefirst item in this block resides on another canvas, then that canvas is displayedautomatically.Of course, if you can already see the item that you want to move to, then youmay click on it directly with the mouse. You can also program mechanisms intothe application to enable navigation in other ways.Confidential © SQL Star International Ltd. 32
  36. 36. Master Versus Detail BlocksTo support the relationship between data blocks and their underlying base tables,you can define one data block as the detail (child) and other as a master (parent)data block. This links primary key and foreign key values across data blocks, andthereby synchronizes the data that these data blocks display.Forms Builder automatically generates the related objects and codes needed tosupport master-detail relationships. As the designer, if you need only thenrequest it. NOTE If your application requires it, you can also create independent data blocks in which there is no relationship between the two data blocks.Single-Record Versus Multi-Record BlocksYou can design a data block to show one record at a time (single-record block) orseveral records at once (multi-Record block). Usually, you create a single-record data block to show master data block and a multi-record data block toConfidential © SQL Star International Ltd. 33
  37. 37. show detail data block. In either case, records in a data block that are currentlynot visible on the screen are stored in a block buffer.Multi-Block and Multi-Form ApplicationsTypically, a Forms Builder application consists of more than one data block. Withmore than one data block, you can do the following: • Separate the navigation cycle of one group of items from another. • Map each data block to a different database table (You can have one base table per data block.) • Produce a master-detail form, with a master data block and the corresponding detail data blocks that are related to the master. • You can create a large form module with many data blocks. Alternatively, you can create several smaller form modules with fewer data blocks in each. • Generally, a modular application with several smaller form modules has the following characteristics: Modules are loaded only when their components are required, thus conserving memory. Maintenance can occur on one module without regenerating or loading the others. Forms can call upon one another, as required.Confidential © SQL Star International Ltd. 34
  38. 38. Block 1 Block 1 Block 1 Form C Block 2 Open Form Block 3 Block 2 Block 1 Form A Open Form Form B Block 4 Single Form Module Multiple Form Modules Forms and Data BlocksMany Blocks or Many Forms? • Parallel development can be carried out by different team members on different components.Here are some points to consider while grouping data blocks in the application: Data Blocks in the Same Form Data Blocks in Different Form Module Modules The data blocks can be directly linked The data blocks cannot be linked by the in master-detail relationships. standard interblock relations. Navigation between data blocks is Navigation between data blocks of handled by default functionality. different forms is programmed by the designer (although mouse navigation to visible items can be automatic).Confidential © SQL Star International Ltd. 35
  39. 39. Library Management ModuleA Brief ExplanationBranch table stores the Unique ID number and location of different branches ofthe library.Member stores the details of the members with their details and to which branchthey belong.Member fee stores the details of the range of age, their fee and the grade.The Book table stores the details for the books present in each branch withnumber of copies.Transaction table stores the daily transaction of issuing to and receiving thebooks back from the members. Only those books are to be issued which arepresent in the BOOK table.Confidential © SQL Star International Ltd. 36
  40. 40. Category stores the details of the category id and the type of books.Publisherdetails stores the details of the publisher.Libstaff stores the details of the librarian staff.Confidential © SQL Star International Ltd. 37
  41. 41. SummaryIn this chapter, you have learnt that: • With Forms Builder, an Oracle Forms Developer component, you can develop form-based applications for presenting and manipulating data in a variety of ways. Forms Builder enables screen-based queries, inserts, updates, and deletes of data. • The Form Builder has three executables: Form Builder, Form Compiler, Form Runtime • Forms Builder provides powerful GUI and integration features. • Applications consist of form modules, menu modules, PL/SQL Library Modules and Object Library Modules. • Oracle Form Builder Interface has Object Navigator, Property Palette:, Layout Editor and PL/SQL Editor Components. • Object Navigator is a hierarchical tree structure of the objects used in the application used to locate and manipulate the objects. • When you run a form, you principally navigate by the way of items and blocks and not by canvases. • Form modules consist of logical data blocks. A data block is the logical owner of items. Items in one data block do not need to be physically grouped. Items in one data block can span several canvases. • Usually, you create a single-record data block to show master data block. • With more than one data block in a Form Builder application you can separate the navigation cycle of one group of items from another. • The data blocks can be directly linked in master-detail relationships and not in standard interblock relations. • Branch table stores the Unique ID number and location of different branches of the library.Confidential © SQL Star International Ltd. 38
  42. 42. Exercise 1. What are the different Forms builder components? 2. Name the form builder interface components? 3. Explain the different kinds of Modules available along with their functionality. 4. In which situations, Single Record block and Multi-records block has to be created. Specify a scenario where creating Single record block and Multi- records block is apt. 5. List the available canvas in the Form builder?Confidential © SQL Star International Ltd. 39
  43. 43. Chapter –4 Basic Form Module Creation Introduction Creating a Data Block Invoking a Layout Wizard Re-entrant Mode Save, Compile and Run a Form Module Creating a Template Form Text Files and Documentation File Extensions of Modules Runtime Modes Manipulate Data using DML Commands Creating a Control Block Deleting a Control Block Master-detail Form ModuleConfidential © SQL Star International Ltd. 40
  44. 44. ObjectiveAt the end of this chapter, you will be able to: • Create a Data block • Know how to invoke a Layout Wizard • Describe the Re-entrant mode • Save, Compile and Run a form module • Create a template form • Understand Text Files and Documentation • Learn about File extensions of modules • Get an idea about Runtime modes • Manipulate data using DML Commands • Plan the way you want to create a Control block • Plan the way you want to delete a Control block • Create Master-detail relationships in form moduleConfidential © SQL Star International Ltd. 41
  45. 45. IntroductionIn the process of creating a Form Module many form builder components areused. To start with the Object navigator, it is used to create an Empty Module. Itis only at this stage, you will find a window created by default. Data block, whichholds the actual data, has to be created through wizard or manually. Once this isdone, align the object or layout editor for further fine-tuning. Functionality to theitems is coded using the PL/SQL. Finally, to test the application, the form builderis executed using the run button on the standard tool bar.You will look at each of these phases in subsequent pages.Creating a Data BlockYou can create a Data Block manually or by using the Data Block Wizard. Thelater enforces integrity constraints by generating code automatically. Aftercreating the data block, use the Layout Wizard to create a good visualpresentation for the application.Starting the Data Block WizardYou can start the wizard in the following ways:Invoke Form Builder and choose the ‘Use the Data Block Wizard’ option in theForm Builder welcome screenIf you are already in the Form Builder then you can do one of the following: • Tools menu -> Data Block Wizard option • Click the right mouse button and select the Data Block Wizard option • In the Object Navigator, choose the Data Block node, and click the Create icon in the toolbar. The New Data Block dialog box appears as shown below.Choose the ‘Use the Data Block Wizard’ option. • In the Layout Editor, click the ‘Data Block Wizard’ icon from the toolbar.Creating a Data Block Using the Data Block Wizard In order to create the block you need to choose appropriate options on the three wizard screens: • Type screen: To select the object that the data block is based on.Confidential © SQL Star International Ltd. 42
  46. 46. • Table screen: To select the database table on which the data block should be based • Finish screen: To create the data block and invoke the Layout Wizard To create a data block based on the Member table, the steps are: 1. In the Type screen, select the Table or View option to create the data block based on a database table as shown below. 2. Click Next to view the Table screen 3. Select the database table on which you want to create your data block. 4. If you are connected to the database, you can browse and select a table name or enter a table name. Enter the table name as Member. or If you are not connected to the database the Connect dialog box is displayed. Enter the username, password and the connect string. 5. Click the Refresh button to display a list of columns from the table you selected as shown below.Confidential © SQL Star International Ltd. 43
  47. 47. 6. Select the column or columns you want to include in the data block. To select multiple columns press [Ctrl] and select all the columns and then release the [Ctrl] key or Click >> or << to include or exclude all the columns. Including a column will enable the user to see that column in the data block. If you exclude the column it will not appear in the data block. Click > or < to include or exclude a single column. 7. Check Enforce data integrity checkbox to enforce data integrity on the client side. The Form Builder does this by writing triggers. These triggers are dealt in a later session. 8. In the finish screen, select Create the Data block, then call the Layout Wizard option and click Finish as shown below.Confidential © SQL Star International Ltd. 44
  48. 48. Invoking a Layout Wizard The Layout Wizard is the easiest way to design a new data block. The Layout Wizard has seven screens and you have to navigate and enter the required information in all the screens in order to design the Layout. The seven screens are: 1. Welcome screen: This screen is shown when you select the Layout Wizard option in the Data Block Wizard finish screen. You can also invoke the Layout Wizard manually in the Object Navigator by selecting Tools Layout Wizard. 2. Canvas screen 3. Data block screen 4. Item Prompt screen 5. Layout Style screen 6. Frames and Rows screen 7. Finish screen The steps to create the layout for the data block are: • On entering the Layout wizard Click Next to proceed further. • Select New Canvas from the list in the canvas screen as shown below to display the data block items.Confidential © SQL Star International Ltd. 45
  49. 49. • Select Content as the canvas type in the Type list and click Next. • In the data block screen, choose the items from the Available Items option. Use the [Ctrl] key to select more than one item or click > or < to include or exclude selected items. Click >> or << to include or exclude all items. You can also drag and drop items to display in a certain sequence. Select all the items. • Select the item type from the Item Type list for each item. Form Builder provides the default type as Item. Click Next to display the Item screen. • In the Item screen, set the prompt values for every item, set the name, text display width and height as shown below:Confidential © SQL Star International Ltd. 46
  50. 50. • Click Next to display the Layout Style screen. • Select the Form or the Tabular option as shown below and click Next to view the Frame and rows screen.Confidential © SQL Star International Ltd. 47
  51. 51. • Enter the Frame title as Member Details • In the Number of Records Displayed field, enter a value. • Leave the Distance Between Records field as it is. • Select the Display scrollbar check box if you want a scroll bar for your data block (if the data block style selected is ‘Tabular’) and now click Next to view the last screen. • In the finish screen, click Finish to create a frame and layout the items for the data block. • The form is displayed in the layout in the Layout Editor. • After you have finished creating the form module and designing its layout, go to the Object Navigator and: • Change the default name of the frame to fr_Member. • Change the default name of the canvas to cnv_Lib. • Change the default name of the window to win_Lib.Confidential © SQL Star International Ltd. 48
  52. 52. NOTE Changing the name of any form module object is the same as that described for changing the name of the Form.Re-entrant ModeWhen you create a form module, the Form Builder provides the form module witha default name MODULEXX. This name is displayed in the Object Navigator and inthe Property Palette.Create a form module and change its default name to frmLib.To change the name of the form module in the:Object Navigator: 1. Double-click the form module name 2. Type frmLib and press [Enter]Property Palette: 1. Double-click the Forms node in the Object Navigator or select the object and select the Property option from the Tools menu 2. Change the name of the form module by typing frmLib in the Name property as shown below:Confidential © SQL Star International Ltd. 49
  53. 53. •Modifying the Appearance of the Data Block To modify the layout of an existing data block, you have to re-enter the Layout Wizard. You can re-enter the Layout Wizard by any of the following two methods: • In the Object Navigator: • Select the form module that you want to customize and click: Tools menu->Layout Wizard option • You can also invoke the wizard by clicking the right mouse button and selecting the Layout Wizard. • In the Layout Editor: • Select the frame of the data block and invoke the Layout Wizard either from the Tools menu or by right-clicking the mouse. • On invoking the Layout Wizard you can change the name of the data block by: Double-clicking the required data block and changing the name in the Object Navigator. Invoking the Property Palette by double clicking the node next o the data block you want to modify.Confidential © SQL Star International Ltd. 50
  54. 54. Save, Compile and Run a Form ModuleOnce the process of creating a form module is complete, you should compile andsave it. Execution process follows immediately and then executes it.Saving a Form Module • Saving a form module can be done in two ways: • In the Object Navigator, select the File menu and click on the Save option. • Click on the Save icon in the toolbar of the Object Navigator. Both the above methods display the File dialog box: Enter the file name Click OK.Compiling a Form ModuleAn executable file must be created to run the form module. To do this you needto compile the form module either,Implicitly: • Select the Edit menu and select the Preferences menu option. • Check the Build before Running check box.Explicitly: • Select the File menu. Select Program Compile Module option. Ensure that the file is open. • Launch the Form Compiler component • Initiate the compiling process from the command line. (FRMCMP.exe)Running a Form ModuleYou can run a form module from: • A Web browser • The Form Runtime Component • The Command line • The Form Builder ComponentYou can run the form module from the Form Builder by clicking one of the fourrun methods, orIn the Object Navigator: Choose the Program menu and select the Run Formoption.Select one of the two run form options: • Web: This option is used to run a form module from a Web previewer. • Debug: This option is used to invoke the debug mode for the current runtime session.Confidential © SQL Star International Ltd. 51
  55. 55. Creating a Template FormAnother method of creating a form is by using a template. This method providesa default starting point to users. You can create standard window layouts,toolbars, graphics and program units in a template form. Steps to create atemplate form are: Invoke the Form BuilderIn the Welcome screen choose the Build a form, based on a template option. Click OK.Text Files and DocumentationAll the files that are created by saving a form module are in binary format. Youcan convert these binary files into text files. The steps to convert a binary fileare: In the Object Navigator, choose File Convert Select the type of module you want to convert and the type you want to convert it to (Binary-to-Text). Choose Convert. To add functionality to your application you can produce documentation for your form module by: Selecting the form module that is to be documented in the Object Navigator. Choosing File Administration Object List Report from the menu. An ASCII file is created with .txt extension. The file has the same name as the module.File Extensions of Modules As you already know that Form Builder has four types of modules Form, Menu, PL/SQL Library and Object Library. Each of these is stored in a different format.Form Modules • .fmb: extension is used for the form design file, it represents form module binary. This file is portable across platforms • .fmx: form module executable or an fmx is the executable runfile. This file is not portable • .fmt: is a text export file and is portable. It represents a form module text. • Menu Modules • .mmb: Represents a menu module binary file. It is the menu design file and is portable. • .mmx: Represents a menu module executable. It is the executable runfile and is not portable. • .mmt: Represents a menu module text. It is a text export file and is portable.Confidential © SQL Star International Ltd. 52
  56. 56. • PL/SQL Library • .pll: PL/SQL Library Document Binary. Files with this extension are design files but can be executed as it contains both the source code and executable code. This file is portable • .plx: PL/SQL Library Document Executable, it is an executable file that does not contain a source code. This file is not a portable file • .pld: PL/SQL Library Document Text is a text export file and is portable • Object Library • .olb: The object library module binary is a design file and is a portable file • .olt: The object library module text is a text export file and is portable • Forms Runtime Environment• The environment in which a form is executed is called the Forms Runtime Environment. Runtime Modes When you run a form, it is always in one of the two modes: • Enter Query mode • Normal mode Enter Query Mode In the Enter Query mode, you can specify a search criterion to retrieve data from the database. When you invoke the form in this mode, the form clears all its contents and waits for the user to key in the criteria. The key strokes that the user types are interpreted as search condition. Forms in this mode allows to: • Retrieve records • Use queries to retrieve restricted records • Use the WHERE clause to retrieve records You can know the number of rows that match your condition before records are retrieved by selecting Query Count Hits Enter Query mode does not allow to: Insert records Update records Delete records Navigate out of the current data block Exit the run time session Confidential © SQL Star International Ltd. 53
  57. 57. Normal Mode Normal mode is used to perform DML operations on the database. In this mode you cannot retrieve restricted set of records. Normal mode allows to: Insert records Update records Delete records Commit Rollback Navigate outside the current block Exit the current sessionRetrieving Data You can retrieve data from the database to make modifications or to view data. You can retrieve data by performing restricted query or an unrestricted query.UnRestricted Query You can retrieve all the records from the database by performing an unrestricted query. You cannot query when you have an unsaved insert, update or delete. Use one of the following to query:In the Forms Runtime, select the Execute option from the Query menu.Click the Execute Query icon from the Forms Runtime toolbar.Restricted Query A Restricted query retrieves records that match your query criteria. You can use the following wildcards in your search condition: Wildcard Character Uses - Replace a single character % Replace any number of characters > Find values greater than < Find values less than < Find values not equal to >, ! = > Find values greater than or = equal to < Find values lesser than or = equal to # Use to make the SQL operator work (#betweenConfidential © SQL Star International Ltd. 54
  58. 58. Wildcard Character Uses ’01-jan-1998’ and ‘10-jan- 2008’) Use the form module frmLib that you just created, to perform a restricted query: • Run the frmLib form module. • Select the Query menu, and click the Enter option or choose the Enter Query icon at the runtime. • Specify the search condition in the required Fields. • For instance: you want to know the book details whose number of copies is greater than 2. Enter >2 in the nnoofcopies field. Now, to Execute the query, select the Query menu and choose the Execute option or click the Execute Query icon. Using a Query/Where dialog box to query the frmLib form module. • In Oracle forms 10g, to invoke Query/Where dialog box, FORMS_RESTRICT_ENTER_QUERY has to be set to FALSE. By default it is set to TRUE. Set this parameter in Default.env file found in devsuite_homeFormsserver. • Run the frmLib form module. • Select the Query menu, select Enter option or click the Enter Query icon. • Enter a colon (:) followed by unique character variable name in one or more items field. • Select the Query menu, select Execute option or click the Execute Query icon.Specify the search condition in the Query/Where dialog box. Use theQuery/Where dialog box to specify a complex search condition using SQL. Also,use the dialog box to execute queries with OR or the ORDER BY clause. Click OK.For example: Enter the following in the Query/Where dialog box, to retrieve allthe member details of all the members whose age is between 18 and 56. : a between 18 and 56Manipulate Data using DML CommandsYou can manipulate records in the Normal mode. In this mode, anything that theuser types is interpreted as an insert and anything that the user keys over anexisting record is interpreted as an update.Steps to insert a record are: 1. Position the cursor on a blank record by:Confidential © SQL Star International Ltd. 55
  59. 59. Scrolling down to a blank record Selecting Record Insert from the menu Click the icon for inserting records from the toolbar 2. Enter data 3. Steps to update a record are: Select the Query -> Enter option Enter the search condition to retrieve the records Select the Query -> Execute option to retrieve the records that match your search condition Select the record you want to update 4. Update the record 5. Steps to delete a record are: Select the Enter option from the Query menu Enter the search condition Select the Execute option from the Query menu to retrieve records Select the record you want to delete and delete the record by doing one of the following: o Select the Remove option from the Record menu o Click the Delete icon from the toolbarMaking Changes PermanentTo make inserts, deletes and updates permanent, do one of the following: • Select the Save option from the Action menu • Click the icon for saving in the toolbarIf you do not want to make inserts, updates and deletes option permanent, youshould clear the record. You can perform a rollback by choosing Action Clear Allfrom the menu.Display Database ErrorsAn error is displayed on the message line in the console area of your FormsRuntime window. This error message is not detailed. If you want any furtherdetails about the message, select the Display option from the Help menu.This opens a dialog box where the top half shows you the code; where there wasan error and the bottom half displays the Oracle Error message.Creating a Control BlockA data block that is not associated with the database is known as a control block.A control block does not interact with data but it exercises control over theapplication. Control blocks are used to enhance the functionality of theapplication. For example, you can create buttons to perform certain functions youneed for the application and place them in a control block.Confidential © SQL Star International Ltd. 56
  60. 60. Steps to create a control block Controlblk in the frmLib form module: • In the Object Navigator, click on the Data Blocks node • Click the Create icon or select the Create option from the Navigator menu • The New Data Block dialog box is displayed, choose the “Build a new data block manually” option. • Open the Property Palette of the data block you just created and change its default name to Controlblk. A control block will not contain any items until you add them manually. Deleting a Block • Deleting a data block deletes all the items that are owned by that particular data block. However, the frame and its title are not deleted. To delete the frame and its title you have to do it manually in the Layout Editor. To delete a data block: • In the Object Navigator, select the data block you want to delete • Click the Delete icon in the toolbar or select the Delete option from the Navigator menu • Click Yes to delete the data block when an alert appears for confirmationMaster-detail Form Module In Form Builder, every form module contains one or more data blocks. These blocks can either be related with each other or they can be independent. To create a relation between blocks, you create a Master-detail form module.Master-detail Relationship A master-detail relation is also called as a parent-child relation. In order to have such a relation it is essential that the master or parent table contain the primary key, which is referenced by the detail or child table. When you create a master-detail block, triggers are created automatically by the Forms Builder to enforce the integrity constraints defined in the database. NOTE A master block can contain more than one detail block. A detail block can be a master to another detail block. A detail block can also have more than one master.Confidential © SQL Star International Ltd. 57
  61. 61. Create a Master-detail Form Module A master-detail form module can be created explicitly or implicitly using the Data Block Wizard. We will create a master-detail form module based on the Branch and Book tables of the Library database. To create a master- detail block: 1. Create a form module and name it as desired, say FrmLibTrans. 2. In the form created, create a master block based on the Branch table. 3. After creating the master block go to the Object Navigator and invoke the Data Block Wizard to create a detail block based on the Book table. 4. Navigate and interact with all the pages in the Data Block Wizard till you see the master-detail page. 5. Uncheck the Auto-join data blocks check box. 6. Click the Create Relationship option. 7. The Relation Type dialog box opens. Select -> Based on a join condition option and click OK. 8. Choose Branch as the master block from the Data Block dialog box that is displayed and click OK. 9. In the master-detail page choose the detail item as cBranchID from the poplist and master item as cBranchID from the master item poplist. You can now see the join condition. 10. Click Next and finish the Data Block Wizard steps. Invoke the Layout Editor and finish creating and designing the data blocks. 11. In the Object Navigator, change the default window name and canvas name to WinLibTrans and CanLibTrans respectively. Ensure that the master block already exists in the form module before you create a master-detail relation. After you have completed creating a master-detail relationship: Form Builder will implicitly create an object called Relation under the master block in the Object Navigator. This relation will automatically handle the relationship between the blocks. A default MASTERDATABLOCK_DETAILDATABLOCK name is assigned to the relation; in this case it will be BRANCH_BOOK. Default triggers and program units are created to maintain the coordination between the two blocks. The following triggers are created automatically: ON-CLEAR-DETAILS ON-POPULATE-DETAILS ON-CHECK-DELETE-MASTERRun a Master-detail Form Module Running a master-detail form module is similar to running a basic form module. Click on the Run icon from the toolbar. At the runtime you will see that:Confidential © SQL Star International Ltd. 58
  62. 62. When you query the master block, the corresponding detail records are also retrieved. Deletion of master records is not possible if corresponding detail records exist. Insertion of a detail record is implicitly associated with the current master record.Create a Relation Manually A Relation is an object that Form Builder creates to maintain the relationship and control the coordination between the blocks. There are two ways of creating a relation: Implicit: Implicit relation as you are already aware of is created when you create a master-detail form module. The relation is also given a default name of MASTERDATABLOCK_DETAILDATABLOCK. Explicit: Explicit relation can be created by setting the properties in the New Relation dialog box. Explicit relation is created between two data blocks whose relation is not yet established. Once you create a relation manually, triggers and PL/SQL program units that control the coordination between the blocks are created implicitly.Steps to Create a Relation Manually To create a relation explicitly, say with PublisherDetails table as the master and Book table as the detail you need to: 1. Create a data block based on the database table PublisherDetails in the form module frmLibTrans 2. Select the Relation node under the master block PublisherDetails in the Object Navigator. 3. Click the Create icon in the toolbar. A New Relation box is displayed. 4. Specify the name of the detail block as Book 5. Specify the Master-delete property 6. Specify the join condition as 7. PublisherDetails.cPublisherID = Book.cPublisherID 8. Click OKControl a Relation The functionality of the relation is enhanced by controlling the block coordination and deletes. This is done by modifying the relation properties. By setting the Delete Record Behavior property you can control the deletion of a record in the master block when the associated records exist in the detail block. The following properties control the master deletes. Non-Isolated: By setting this property you can prevent the deletion of master records when corresponding detail records exist. Default property is set to ‘Yes’. Cascading: By setting this property you can delete all the detail records when a master record is deleted. But the commit message will show only the number of master records that were deleted. Isolated: By setting this property you can delete the master record even if corresponding detail records exist.Confidential © SQL Star International Ltd. 59
  63. 63. NOTE The default setting is Non-Isolated. When you change the property from the default value to Cascading, Form Builder replaces the ON-CHECK-DELETE-MASTER trigger .with a PRE- DELETE trigger. Changing the property from Non-Isolated to Isolated deletes the ON-CHECK-DELETE-MASTER trigger. Coordination Property Set the coordination property to control the display of the detail block records whenever the master block is queried. The coordination property options are: Default: When a user or trigger changes the master record, this property enforces the coordination of the blocks. Deferred with Auto Query: Processing of the detail query is postponed until the cursor is in the detail block. Deferred Without Auto Query: Additional query criteria can be specified in the detail block before querying. Prevent Masterless Operations: Querying or inserting into a detail block is not allowed till the corresponding master record is displayed. Confidential © SQL Star International Ltd. 60
  64. 64. SummaryIn this chapter, you have learnt that: • Object navigator is used to create an Empty Module. • You can create a Data Block manually or by using the Data Block Wizard. After creating the data block, use the Layout Wizard to create a good visual presentation for the application. • To create the block you need to choose appropriate options on the three wizard screens: Type screen, Table screen, Finish screen • The Layout Wizard has seven screens to navigate and enter the required information for designing the Layout. • When you create a form module, the Form Builder provides the form module with a default name MODULEXX. • To modify the layout of an existing data block, you have to re-enter the Layout Wizard. After invoking the Layout Wizard you can change the name of the data block • Once the process of creating a form module is complete, you should compile and save it. You can run a form module from a Web browser, Form runtime component, the Command line and the Form builder component. • You can also create a form by using a template. • When you run a form, it is either in enter query mode or normal mode. • In Normal mode anything that the user types is interpreted as an insert and anything that the user keys over an existing record is interpreted as an update. • A data block that is not associated with the database is known as a control block. • You can create a Master-detail form module to create a relation between blocks. • The functionality of the relation is enhanced by controlling the block coordination and deletes which is eventually done by modifying the relation properties.Confidential © SQL Star International Ltd. 61
  65. 65. Lab ExerciseModule containing Single Block 1. Create a new form module. Create a new single block using data block wizard. Base it on the BOOK table and include all columns. 2. Using the layout wizard, place BOOK block on the new canvas. As you pass through the layout wizard change the prompt according to the following specification. Choose the Style as Form and show just one record at a time. 3. Rename the canvas name to CV_BOOKS 4. In the layout editor, reposition the items and edit the prompts. o Now on the canvas select the frame and remove. Create a rectangle on the canvas such that it fits the block items. o Add a label as Book Details. o Now change the canvas background color to gray4 and rectangle background color to gray16. 5. Save the new module as BOOK_mac_no where mac_no is the machine number on which you are working. 6. Run your form module and execute a query. Your book information should resemble as follows:Confidential © SQL Star International Ltd. 62
  66. 66. • Query the books, which are present only in ‘01ADLNJ’ branch. • Give the details of the books published in the year from 1996 to 1998 . • Exit the run-time session and return to forms builder. • Change the form module name in the object navigator to BOOKS. • Save and compile the form module.Module containing multiple blocks: Master-DetailsRelationships1. Create a new form module. Next, Invoke the data block wizard to create a block. BRANCH based on BRANCH table. Create a block BRANCH by using the data block wizard. Base it on the BRANCH table and include all the columns except CPHONE and DESTBL. o Display the BRANCH block on a new content canvas called CV_BRANCH and show just one record at a time. o Use a form style layout.2. Create a new block by using the data block wizard. Base it on the MEMBER table and include all the columns.3. Create a relationship between BRANCH and MEMBER where BRANCH will serve as a master block and MEMBER will be the detail block.Confidential © SQL Star International Ltd. 63
  67. 67. When, continuing in the layout wizard make the following changes in MEMBER block. o Display all items except CBRANCHID on the CV_BRANCH canvas. o Use a tabular style of layout. o Display 5 records in this detail block on the same canvas as the master block.After you finish, your form would look as below:Change the order of the blocks in the object navigator, moving the MEMBER blockafter the BRANCH block.Save the new module as BRANCHXX, where XX is the unique number. Now createanother new block with following specification.Base it on the TRANSACTION table. Place the items of this block on a new contentcanvas called CV_TRANSACTION. o Use a tabular style layout and include a scroll bar. o In the object navigator, move the TRANSACTION block after the MEMBER block. o Do not create any relationship between blocks at this stage.The transaction details would be something like this:Confidential © SQL Star International Ltd. 64
  68. 68. 4. Create a relation called MEMBER_TRANSACTION explicitly between the MEMBER and TRANSACTION blocks. Ensure that TRANSACTION details should not be executed independent of MEMBER table. i.e. No query or insert operation is allowed unless parent is displayed. Save and Compile your form module. Click Run Form to run your form. Execute all the block. Navigate through the blocks so that you see the TRANSACTION block. Exit the run-time session, close the browser, and return to Forms Builder. Change the form module name in the Object Navigator to BRANCH and saveit.5. Create a non-base block in the BRANCHXX form. Name this block asCONTROL. o Set the Database Data Block, Query Allowed, Insert Allowed, Update Allowed, and Delete Allowed Database properties to NO. o Set the Query Data Source Type property to None. Set the single record property to yes. o Leave other properties as default. Move the CONTROL block to end of the all blocks. Note: The Compilation errors window displays a warning that advises you that the CONTROL block has no items. This is expected (until you add some items to the CONTROL block in a later lesson).Confidential © SQL Star International Ltd. 65
  69. 69. Chapter 5 Discuss Data Block Properties Data Block Properties Manipulate the Frame Properties Opening Multiple Property Palette Multiple Object PropertiesConfidential © SQL Star International Ltd. 66
  70. 70. ObjectiveAt the end of this chapter, you will be able to: • Describe the Properties of a Data block • Learn to manipulate the Frame properties • Know how to open Multiple property palette • Understand the concept while using Multiple object propertiesConfidential © SQL Star International Ltd. 67
  71. 71. Data Block Properties Every object in the form builder has certain properties associated with it. These properties have default values assigned to them. You can change these default values by assigning new values in the Property Palette of each and every object created. A data block is the owner of the items created under it. All these items have their individual properties. The data block itself also has some properties. You can customize the appearance and behavior of the data block and its items by setting their properties. To change the behavior of a data block invoke the data block Property Palette and set the properties.Property Palette To invoke the Property Palette of an object, use one of the following methods: • In the Object Navigator: 1. Select the object 2. Select the Property Palette menu option from the Tools menu • Double-click the object icon in the Object Navigator • In the Layout Editor, double-click the object • In the Object Navigator or the Layout Editor 1. Select the object 2. Click the right mouse button 3. Select the Property Palette option from the pop-up menu that is displayedYou can also invoke property palette by selecting the object->F4 The tools provided by the Property Palette are: • Property List: The property list is a list, which contains the property names and their corresponding values. The properties are grouped under nodes. You can expand or collapse a node by using the property palette icons. You can navigate to each of the property name and set the required value. • Find field: This field enables you to search for a property name quickly and easily. • Toolbar: It provides quick access to commands. For example cut and paste.Using the Property Palette The Property Palette has the following property controls with which you can manipulate properties: • Text field: This field is displayed when the value of the property can be set by entering the text. If the text that has to be entered is long then an icon appears, by clicking the icon you can invoke an editor to enter the text. • Poplist: This is displayed when there is a fixed set of values. Click on the arrow to display the list and choose a value. You can also double-click on the property name to view the values.Confidential © SQL Star International Ltd. 68