375
Confidential © SQL Star International Ltd. 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, INDIA

10g forms

Embed Size (px)

DESCRIPTION

ORACLE FORMS 10 G

Citation preview

  • 1. Oracle 10g Forms This book belongs toName:______________________________________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. Copyright 2008Second EditionSQL 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. 23101663Toll Free No: 1800 425 2944Email:[email protected] 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. Table of contents 10g FORMS CHAPTERCHAPTER TITLE PAGE No. NO1. Introduction to Oracle Forms Developer Suit 1 122. Running a Forms Developer Application 13 253. Forms Developer Interface 26 394. Basic Form Module Creation40 655. Discuss Data Block Properties 66 776. Creating Text items, LOVs and Editors 78 1007. Creating Input and Non-Input Items101-1268. Windows & Canvases127-1429. Triggers143-167 10. Item InteractionTriggers and Alerts 168-193 11. Item Validation and QueryTrigger194-213 12. Navigation214-228 13. Key & Mouse Event Triggers229-249 14. Transaction Triggers250-263 15. Flexible Code 264-275 16. Sharing Objects and Code276-292 17. WebUtil for Client Interaction293-308 18. Working with Multiple Form Applications 309-340 19. Managing Menus341-372Confidential SQL Star International Ltd.iii 4. Chapter 1 Introduction to Oracle Forms Developer Suite Introduction to Internet Computing ProductsGrid computingOracle10g Tools for Forms developmentOracle10g AS Architecture Oracle10g Provides Oracle Forms Services Benefits of Oracle10g Developer Suite What Is Oracle Forms Developer SQL Star International Ltd1 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. 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 Oracles 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. 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. 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. 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. 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 applications 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 ServicesForms 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. Thisforms 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. 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. 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 APIs, 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. 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. 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. 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. Chapter 2 Running a Forms Developer Application Introduction to Three-tier Architecture Testing a FormJava Runtime Environment Starting a Run-time Session Form Application in a Web BrowserOracle Environment variablesConfidential SQL Star International Ltd. 13 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. 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 clients 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. 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 applications 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. 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 Oracles 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. 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 http://127.0.0.1:8889/forms/frmservletRunning of a FormIn order to run the application in a web browser, the users 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 theapplication startup time. It provides applet instance caching. This is a method of storing therunning form application during navigation event. When the userConfidential SQL Star International Ltd.18 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. 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. 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 textBoilerplate graphicsPromptsConfidential SQL Star International Ltd.21 25. Text items List items Push buttons Display items Radio buttons Check boxes Image items Hierarchical tree items Chart items Custom itemsOracle Developer Environment VariablesIn order to customize the application, following environment variables can bemodified.Forms environment variables for design time UI_ICON_EXTENSIONFORMS_BUILDER_CLASSPATHFORMS_HIDE_OBR_PARAMSSet to FALSE to be able toSet so that forms builder see the hidden parameterscan find java class files passed in the URLduring development andtesting processUI_ICONType of the iconic image, i.e., gif, jpeg of .ico mustTo create iconic images in be specified hereforms builder, path of theicon is set hereConfidential SQL Star International Ltd. 22 26. Forms environment variables for runtime FORMS_RESTRICT_ENTER _QUERYFORMS_PATHCLASSPATHSet this parameterGives path of the FormORACLE_PATH Specifies path of to True to invokebeing searched by Java Class file the Query/WhereForms builder to run it required for Formsdialog box. Bydefault it is set toSpecifies the search path False.for files referenced byReports RuntimeAlternatively, you can control the environment variable setting in file known asformsserverdefault.envConfidential SQL Star International Ltd. 23 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 clients Java enabled web browser. Oracle10g AS Containers for J2EE (OC4J) is Oracles 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 users 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. 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. Chapter 3 Forms Developer InterfaceThe Form Builder EnvironmentThe Form Builder Components The Form Builder Module TypesOracle Form Builder Interface Components Form Module ObjectsNavigation in a Form Module Master versus Detail Blocks Multi-Block and Multi-Form ApplicationsLibrary Management ModuleConfidential SQL Star International Ltd. 26 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. 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 ComponentsThe Form Builder has three executables that help to create, compile andrun a form module:Form Builder: It is used to design and build applications and store thedefinition. It can be invoked using FRMBLD.EXEForm Compiler: It is used to read the definition of the form module andconvert them into an executable run file. It can be invoked usingFRMCMP.EXEForm Runtime: It is used to execute a form module. Before you want torun a Form, ensure that the form module is compiled.The Form Builder Module TypesForm Builder allows you to create four types of modules, which are stored asfiles. A module owns all the objects that are created within it and is the basisof storage and ownership. The different types of modules in Form Builder are: Form Modules: These make up the major chunk of your application. In aform module you retrieve and manipulate data that is arranged in the formof records. Menu Modules: Form Builder enables users to create their own menus. Themenu of an application is created and stored in a menu module. Users cancustomize or replace the default menu provided by Oracle FormsDeveloper. PL/SQL Library Modules: This is a collection of all the PL/SQL programunits that can be used by other modules in your application. Object Library Modules: An object library allows you to store objects thatyou can reference and use in other modules. This feature enables you tocreate objects and distribute them throughout the organization.Confidential SQL Star International Ltd.28 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. . Layout Editor: Provides an interface to create and arrange the items and graphical objects in your application.Confidential SQL Star International Ltd. 30 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. 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:oDocument or modeless windowoDialog 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 Canvaso Stacked Canvaso Tab Canvaso 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 thedatabase tables, views, stored procedures, a FROM clause query, or atransactional 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. 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 independentdata blocks in which there is no relationship between the two datablocks.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. 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, thusconserving memory.Maintenance can occur on one module without regenerating or loadingthe others.Forms can call upon one another, as required.Confidential SQL Star International Ltd. 34 38. Block 1 Block 1 Block 1 Form C Block 2Open Form Block 3 Block 2 Block 1 Form A Open FormForm B Block 4 Single Form ModuleMultiple Form ModulesForms 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 FormModule ModulesThe data blocks can be directly linked The data blocks cannot be linked by thein master-detail relationships.standard interblock relations.Navigation between data blocksis Navigation between data blocks ofhandled 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. 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. 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. 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. Exercise 1. What are the different Forms builder components? 2. Name the form builder interface components? 3. Explain the differentkinds of Modulesavailable along with theirfunctionality. 4. In which situations, Single Record block and Multi-records block has to becreated. 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. Chapter 4 Basic Form Module Creation IntroductionCreating a Data Block Invoking a Layout WizardRe-entrant ModeSave, Compile and Run a Form ModuleCreating a Template Form Text Files and DocumentationFile Extensions of ModulesRuntime ModesManipulate Data using DML Commands Creating a Control Block Deleting a Control BlockMaster-detail Form ModuleConfidential SQL Star International Ltd.40 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. 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. Table screen: To select the database table on which the data blockshould be based Finish screen: To create the data block and invoke the Layout WizardTo create a data block based on the Member table, the stepsare: 1. In the Type screen, select the Table or View option to create the datablock 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 tablename 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 youselected as shown below.Confidential SQL Star International Ltd. 43 47. 6. Select the column or columns you want to include in the data block. Toselect multiple columns press [Ctrl] and select all the columns and thenrelease the [Ctrl] key or Click >> or or < to include or exclude a single column. 7. Check Enforce data integrity checkbox to enforce data integrity on theclient side. The Form Builder does this by writing triggers. These triggersare dealt in a later session. 8. In the finish screen, select Create the Data block, then call the LayoutWizard option and click Finish as shown below.Confidential SQL Star International Ltd.44 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 Wizardoption in the Data Block Wizard finish screen. You can also invoke theLayout Wizard manually in the Object Navigator by selecting ToolsLayout Wizard. 2. Canvas screen 3. Data block screen 4. Item Prompt screen 5. Layout Style screen 6. Frames and Rows screen 7. Finish screenThe 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. 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 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. 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 nameClick 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. 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 FileAdministration 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 ModulesAs you already know that Form Builder has four types ofmodules 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 formmodule binary. This file is portable across platforms .fmx: form module executable or an fmx is the executable runfile. Thisfile is not portable .fmt: is a text export file and is portable. It represents a form moduletext. Menu Modules .mmb: Represents a menu module binary file. It is the menu design fileand is portable. .mmx: Represents a menu module executable. It is the executablerunfile and is not portable. .mmt: Represents a menu module text. It is a text export file and isportable.Confidential SQL Star International Ltd.52 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 portableObject 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 portableForms Runtime EnvironmentThe environment in which a form is executed is called the Forms RuntimeEnvironment.Runtime ModesWhen you run a form, it is always in one of the two modes: Enter Query mode Normal modeEnter Query ModeIn the Enter Query mode, you can specify a search criterion to retrieve data fromthe database. When you invoke the form in this mode, the form clears all itscontents and waits for the user to key in the criteria. The key strokes that theuser 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 recordsYou can know the number of rows that match your condition before records areretrieved by selecting Query Count HitsEnter Query mode does not allow to: Insert records Update records Delete records Navigate out of the current data block Exit the run time sessionConfidential SQL Star International Ltd. 53 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 QueryYou can retrieve all the records from the database byperforming an unrestricted query. You cannot query whenyou have an unsaved insert, update or delete. Use one ofthe 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 CharacterUses -Replace a single character %Replace any number ofcharacters >Find values greater than , ! = >Find values greater than or =equal to 2 in the nnoofcopies field.Now, to Execute the query, select the Query menu and choosethe 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. 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. 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. 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 theData 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 yousee 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 conditionoption and click OK. 8. Choose Branch as the master block from the Data Block dialog box that isdisplayed and click OK. 9. In the master-detail page choose the detail item as cBranchID from thepoplist and master item as cBranchID from the master item poplist. Youcan 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 formmodule before you create a master-detail relation. After youhave completed creating a master-detail relationship:Form Builder will implicitly create an object called Relationunder the master block in the Object Navigator.This relation will automatically handle the relationshipbetween the blocks.A default MASTERDATABLOCK_DETAILDATABLOCK name isassigned to the relation; in this case it will beBRANCH_BOOK.Default triggers and program units are created to maintainthe coordination between the two blocks. The followingtriggers are created automatically: ON-CLEAR-DETAILS ON-POPULATE-DETAILS ON-CHECK-DELETE-MASTERRun a Master-detail Form ModuleRunning a master-detail form module is similar to running abasic form module. Click on the Run icon from the toolbar.At the runtime you will see that:Confidential SQL Star International Ltd. 58 62. When you query the master block, the corresponding detailrecords are also retrieved.Deletion of master records is not possible if correspondingdetail records exist.Insertion of a detail record is implicitly associated with thecurrent master record.Create a Relation ManuallyA Relation is an object that Form Builder creates to maintainthe relationship and control the coordination between theblocks. There are two ways of creating a relation:Implicit: Implicit relation as you are already aware of iscreated when you create a master-detail form module. Therelation is also given a default name ofMASTERDATABLOCK_DETAILDATABLOCK.Explicit: Explicit relation can be created by setting theproperties in the New Relation dialog box. Explicit relation iscreated between two data blocks whose relation is not yetestablished. Once you create a relation manually, triggersand PL/SQL program units that control the coordinationbetween the blocks are created implicitly.Steps to Create a Relation ManuallyTo create a relation explicitly, say with PublisherDetails table as themaster and Book table as the detail you need to: 1. Create a data block based on the database table PublisherDetails in theform module frmLibTrans 2. Select the Relation node under the master block PublisherDetails in theObject 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 RelationThe functionality of the relation is enhanced by controlling the blockcoordination and deletes. This is done by modifying the relationproperties.By setting the Delete Record Behavior property you can control thedeletion of a record in the master block when the associated recordsexist in the detail block.The following properties control the master deletes.Non-Isolated: By setting this property you can prevent the deletion ofmaster records when corresponding detail records exist. Defaultproperty is set to Yes.Cascading: By setting this property you can delete all the detailrecords when a master record is deleted. But the commit message willshow only the number of master records that were deleted.Isolated: By setting this property you can delete the master recordeven if corresponding detail records exist.Confidential SQL Star International Ltd.59 63. NOTEThe default setting is Non-Isolated. When you change theproperty from the default value to Cascading, Form Builderreplaces the ON-CHECK-DELETE-MASTER trigger .with a PRE-DELETE trigger. Changing the property from Non-Isolated toIsolated 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. 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. Lab ExerciseModule containing Single Block 1. Create a new form module. Create a new single block using data blockwizard. Base it on the BOOK table and include all columns. 2. Using the layout wizard, place BOOK block on the new canvas. As you passthrough the layout wizard change the prompt according to the followingspecification. 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 machinenumber on which you are working. 6. Run your form module and execute a query. Your book information shouldresemble as follows:Confidential SQL Star International Ltd. 62 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 serveas a master block and MEMBER will be the detail block.Confidential SQL Star International Ltd.63 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. 4. Create a relation called MEMBER_TRANSACTION explicitly between the MEMBER and TRANSACTION blocks.Ensure that TRANSACTION details should not be executed independent ofMEMBER table. i.e. No query or insert operation is allowed unless parent isdisplayed.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 theTRANSACTION block. Exit the run-time session, close the browser, and returnto 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 singlerecord property to yes. o Leave other properties as default. Move the CONTROL block to endof the all blocks.Note: The Compilation errors window displays a warning that advises you thatthe CONTROL block has no items. This is expected (until you add some itemsto the CONTROL block in a later lesson).Confidential SQL Star International Ltd. 65 69. Chapter 5 Discuss Data Block Properties Data Block Properties Manipulate the Frame PropertiesOpening Multiple Property Palette Multiple Object PropertiesConfidential SQL Star International Ltd.66 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. 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 Editor1. Select the object2. Click the right mouse button3. 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 72. LOV window: A list of values is displayed when there is a large list available. Invoke the list of values by clicking the icon in the property value column. Select the appropriate value by clicking it. More button: This is displayed when additional settings are needed. Click the More button to open a dialog box.Property Palette IconsIn the Property Palette every property has an icon on its left.The following are the icons that you will encounter in aProperty Palette. Circle: Signifies the default value. Square: Signifies that the default value has been changed. Arrow: Signifies an inherited property value. Arrow with a cross: Signifies an inherited value that is overwritten.ChangedDefaultOverriddenInheritedVisual AttributesFont, color, and pattern properties set for form and menu objects areVisual Attributes. Visual Attributes are created in the Object Navigator.Once a visual attribute is created it can be used for different forms, menusand items. Every interface object in a form module has a property namedVisual Attribute Group. By setting this property to DEFAULT or user-defined visual attribute, you can influence the appearance of thatparticular item.Steps to create a visual attribute say vattLib and attach it to the Memberdata block in the frmLib form module: 9. Select the Visual Attribute node in the Object Navigator and click theCreate icon. 10. Invoke the Property Palette, change the default name to vattLib and set the following properties:Foreground Color: BlackBackground Color: Grey20Font Name: ArialFont Size: 10Confidential SQL Star International Ltd.69 73. Font Weight: LightFont Style: Plain 11. Invoke the Property Palette for the Member data block, set the Current Record Visual Attribute Group property to vattLib to highlight the current record at runtime. 12. Another type of visual attribute is the partial visual attributes. These are similar to visual attributes. The only difference is that you need to set only those properties that will be used by objects that use them.Manipulate the appearance and behavior of a Data Block A data block has properties that are divided into groups: General Navigation Records Database Advanced Database Scrollbar Visual Attribute Group Color InternationalNavigation Properties Invoke the Property Palette of the data block by double clicking the data block node to the left of the data block. When you set the following properties, it allows you to control the navigation in a data block: Navigation Style: When you try to navigate beyond the last item in a record, the cursor is returned to the first item of the same record. This is the default setting. You can control the cursor position by setting its property to any of the following options: Same Record: This is the default setting. If you try to navigate beyond the last item in a record the cursor will return to the beginning of the record. Change Record: The cursor will move to the next record when you try to navigate beyond the last item in a record. Change Data Block: The cursor will move to the next data block in the form module Previous/Next Navigation Data Block: In a form module all the data blocks will have a pre-determined order for navigation. By default, the pre-determined order of navigation is based on the order in which data blocks are positioned in the Object Navigator. By specifying the name of the data blocks in the Previous and Next Navigation Data Block property fields, you can control the navigation to the previous and next blocks.Confidential SQL Star International Ltd. 70 74. Database Properties The database properties are important to the application developers. These properties will enforce integrity constraints. It will also allow query, insert, update, delete and the number of records that are to be retrieved on querying. Some of the important database properties that control the behavior of the data blocks are: Database Data Block: Set this property to Yes if the data block is based on a database object and No when the data block is not based on a database object. For example, a control block. Enforce Primary Key: Set this property to Yes for the Form Builder to check that the records are unique and satisfy the primary key condition before they are inserted into the table. Query Allowed: Set this property to Yes to allow queries on the data block. Insert/Update/Delete Allowed: Set this property to Yes if you want the user to enable to manipulate data. If set to No a user will not be able to perform DML operations on the data block. DML Array Size: Set this property to control the number of records that will be sent to the server for batch processing. WHERE Clause: By specifying a WHERE clause for the data block, you restrict the number of records that are retrieved. If the user gives a search condition in the Enter Query mode, then this WHERE clause is automatically appended to the user search criteria. ORDER BY Clause: Set this property to determine the order of retrieval of the records. You can use the Query/Where dialog box at run time to modify this order. Optimizer Hint: This property improves the performance and efficiency of the database transactions. Form Builder passes a hint string to the optimizer while constructing an implicit SQL statement on the data block. Update Changed Columns: If a user is updating a record, set this property to Yes to send values to the server of only those columns that were updated instead of the entire record. Enforce Column Security: Items in the data block can be updated only if the user has the permission to update them. Set this property to Yes to restrict access to sensitive database columns.Record Properties The following are the important record properties: Query Array Size: This property controls the number of records that will be fetched from the database. Number of Records Buffered: Set this property to specify the number of records that will be kept in the client memory. The default value is 3. Current Record Visual Attribute Group: Set this property to associate a visual attribute to the data block to highlight the current record.Confidential SQL Star International Ltd. 71 75. Number of Records Displayed: Set this property to specify the maximum number of records that can be displayed on the canvas. Query All Records: Set this property to retrieve all the records that match the query criteria. Record Orientation: Set this property to display the records in a data block vertically or horizontally. Single Record: This property is specific to a control block. Set this property to Yes for a data block containing summary calculated item.Scroll Bar Properties The following are the scroll bar properties: Show Scroll Bar: Set this property to Yes to display a scroll bar for the data block. Set this property to No to delete an existing scroll bar. Scroll Bar Canvas: Set this property to specify on which canvas the scroll bar has to be created and displayed. Scroll Bar Orientation: Set this property to specify if the scroll bar has to be displayed horizontally or vertically. Reverse Direction: Set it to Yes to make the scroll bar scroll in the reverse direction.Manipulate the Frame Properties All the items within a data block are automatically arranged in a frame when you associate the frame with a block. Therefore, a data block can be associated with only one frame. Manipulate the frame properties to design the arrangement of items within a frame. A few of the frame properties are: Layout Data Block: To specify the data block with which the frame should be associated. All the items of the data block are arranged in this frame. Update Layout: Its settings are as follows: Automatically: Any changes in the frame layout property or movement or resizing of the frame results in the layout being automatically updated. Manually: The layout is updated when you use the Layout Wizard to modify the frame or when you click on the Update Layout in the Layout Editor. Alternatively you can select the Arrange menu and choose the Update option in the Layout Editor. Locked: The layout cannot be updated. Frame Title Alignment: To specify the position of the frame title. Number of Records Displayed: To specify the number of records those are to be displayed. Layout Style: To specify Form or Tabular Distance Between Records: To specify the distance between two records in a frame.Confidential SQL Star International Ltd.72 76. Bevel: To specify the type of frame border. The options are: Raised Lowered None Inset Outset PlainOpening Multiple Property Palette As you already know all the visual objects of the data block have properties associated with them. These properties have default values and the user can modify these values in the Property Palette. You can open multiple property palettes, compare and set these properties. You can display the properties of an object in multiple property palettes by selecting the object in the object Navigator and then by pressing F4. By Double clicking the object icon pressing the [Ctrl] key in the Object Navigator when a Property Palette is already open for an object. This will open another Property Palette for the object. You can display the Property Palettes for more than one object at a time: Invoke the Property Palette of an object. Click the Freeze icon on the Property Palette toolbar. Now open the Property Palette for the second object by using F4. It will open in a separate window.Confidential SQL Star International Ltd. 73 77. Two palettes for one itemTwo palettes for two itemsMultiple Object PropertiesYou can set properties for multiple objects in a data block at the sametime. In the Object Navigator select the objects that you want to setproperties for and invoke the Property Palette to display a combinationof properties for all the objects that you selected. To choose acombination of properties set either of the two options:Union: You can set the combination to union by clicking theUnion/Intersection button in the Property Palette toolbar. This willdisplay the common as well as the unique properties of all the objectsthat you select.Intersection: This is the default option. Use this option to display onlythe common properties of all the objects that you select. When you click on Union/Intersection button in the toolbar it will alwaystoggle between the two options. Steps to set properties for multiple objects:In the Object Navigator invoke the Property Palette for one of theobjects.Press the [Ctrl] key and click on the objects whose properties are to bemodified simultaneously.Holding the [Ctrl] key click the right mouse button and select theProperty Palette option.Confidential SQL Star International Ltd.74 78. Select the Union/Intersection button to display the required properties.Modify the properties as required. The modifications you make hereare applied to all the objects that you select.Copying PropertiesYou can copy properties and apply them to other objects in your formmodule by:Invoking the Property Palette and setting the values for the properties thatare to be copied. The Property Palette can belong to a single object or acombination of objects.Selecting All properties:To copy all the property values, select the Edit menu in the Property Paletteand choose the Select All option.Selecting specific properties:To copy some specific properties, press the [Ctrl] key and select eachproperty individually by: Clicking the Copy Properties icon in the Property Palette toolbar. Selecting the object (from the Object Navigator) in which the properties are to be copied. Invoke its Property Palette. Clicking the Paste Properties icon in the Property Palette toolbar. All the properties that you copied will be applied.Property Classes A Property Class is a Form Builder object that contains properties and property values, which can be inherited by other objects. Creating a Property Class and saving it for future applications will save a lot of development time, as there will not be a need of defining property values again for all the objects. More of this will be discussed later in subsequent chapters.Confidential SQL Star International Ltd.75 79. SummaryIn this chapter, you have learnt that: There are various Data Block properties and features of Property Palette and how to invoke a property palette, etc. To invoke the Property Palette of an object, you can either select the object or you can select the Property Palette menu option from the Tools menu given in the Object Navigator: The Property Palette has Text field, Poplist, LOV window, More button following property controls with which you can manipulate properties: In the navigation properties, Navigation Style is the default setting by which you can control the cursor position by setting its property to the same record, change record and change data block. The database properties allow query, insert, update, delete and the number of records that are to be retrieved on querying. You can copy properties and apply them to other objects in your form module by invoking the Property Palette and setting the values for the properties that are to be copied which can belong to a single object or a combination of objects. Some of the important record properties are Query array size, Number of records Buffered, Current record visual attribute group etc. To design the arrangement of items within a frame, you can manipulate the frame properties like in case of Layout data block, Frame title alignment and Distance between records etc. You can set properties for multiple objects in a data block at the same time. A Property Class is a Form Builder object that contains properties and property values, which can be inherited by other objects.Confidential SQL Star International Ltd.76 80. Lab Exercise 1. Create avisual attribute named Current_Record with following specification: Background Color: Gray16 Foreground Color: Black Fill pattern: Transparent Use this visual attribute for Member and transaction block present in the BRANCHXX module. 2. Check the navigation of the Member block. Make the necessary changes sothat the user is able to navigate between the records using tab. 3. Ensure that the records retrieved in the BRANCH block are sorted by theCBRANCHID. 4. Try to open the property palette of Branch and Member blocks togetherand compare them. 5. Try multi-section of properties between any two blocks in BranchXXX.Compile and save the form.Confidential SQL Star International Ltd. 77 81. Chapter 6 Creating Text Items,LOVs and Editors Methods to Create Text ItemsControlling the Appearance of a Text ItemCreating a Multi-line Text Item Modify Text Items Navigation of a Text ItemEnhancing the Functionality of a Text ItemUsing Helping facilityList of Values (LOVs) Defining a LOVCreating LOVsDiscuss the LOV PropertiesInvoking the LOV EditorsConfidential SQL Star International Ltd. 78 82. ObjectiveAt the end of this chapter, you will be able to: Use Text items Know the Methods to create Text items See how to Control the appearance of a Text item Create a Multi-line Text item Associate Text with an item Change the Prompts by replacing the existing prompts Modify Text item Control the navigation of a Text Item Alter the Database Properties Enhance the Functionality of a Text item Learn the use of help facility Identify, define and create List of Values (LOVs) Remember the LOV Properties Know how to associate an LOV with a Text Item Invoking the LOV EditorsConfidential SQL Star International Ltd. 79 83. Text Items As you already know a form module consists of data blocks and the data blocks in turn are made up of objects or items. A text item is a user interface object, which enables the user to manipulate data. You can modify the properties to alter the appearance and behavior of the text items. A text item will allow you to