We need to create data block using the table we have created in database or we can create manually without table from database(Non database purpose/query from form)
In general, a Data Block on a form corresponds to a table in the database. This is called the Base Table for the data block. For each table displayed on the form, a new data block will be created.
A block appears on a Canvas which is contained in a Window. There are many options to control multiple canvas views and multiple windows per form.
There are a number of ways to create a data block. One way is to manually define the base table and columns, and their positions on the form. While this is possible, it can be very tedious.
Oracle Forms Builder provides two main wizards (programs that guide the developer in performing common tasks) to create data blocks:
- The Data Block wizard guides the developer through the steps of choosing a base table and columns.
- The Layout wizard guides the developer through arranging the base table and columns on the form.
the below data block wizard will be opened with checked on "Display this page next time".
Click on "Next" button,the below window will open to select the type of data bock with two radio button options.
- Table or View
- Stores Procedure
For example,data block will be created for the TICKET_BOOKING table.
The next step is to choose a base table and columns that will belong to the data block. The following dialog box will appear:
To associate a database table with the block, click on the Browse… button to the right of the Table or View field. The following dialog box will pop up.
Make sure the Current User and Tables buttons are selected A list of your tables will appear. If no list of tables appears, make certain you have created the tables. If you are still logged in to SQL*Plus, make certain you issue a “COMMIT;” statement to commit all of the changes to the schema.
Highlight the name of the database table (TICKET_BOOKING in this example) and click on the OK button.
The wizard should reappear with the name of the table and a list of available columns displayed. To include a column in the data block, highlight the column name and click on the right arrow. The name of the column should move over to the right hand side.
For this example, select the TICKET_NO, FROM_PLACE, TO_PLACE, DATE_OF_JOURNEY, BOARDING_POINT and BUS_NAME as in the following figure:
Click on the Next button, a dialog box will appear allowing you to name the data block. In general, it is best to simply use the name of the table as the name of the data block as shown below:
Click the Next button once more and the final dialog box for the Data Block wizard will appear:
In this example, we want to continue on to the Layout wizard in order to specify how the new form will appear. Make sure the Create the block, then call the Layout wizard option is selected and click on the Finish button.
The data block will be created (as can be seen in the Object Navigator in the background). The objects created include the EMPLOYEE data block containing items for each of the columns that were selected in the third step of the wizard.
Once the new data block and items are created, the first dialog box in the Layout wizard will appear:
Click on the Next button and the following dialog box will appear:
The layout for a data block may be placed on any existing canvas. In this case, there are no existing canvases so the only option available is to create a new canvas.
Click on the Next button to display the following dialog box:
In this dialog box, the columns from a given base table on a data block can be added to the layout. Since we are laying out the TICKET_BOOKING data block, it is highlighted automatically.Move all of the Available Columns over to the Displayed Items side by clicking on the double right arrow and click on the Next button.
In this dialog box, the field labels, field sizes and field heights can be altered. Change the field labels as shown below and click on the Next button:
The following dialog box will appear:
Form Style :
There are two main styles for forms. A Tabular layout arranges the field labels across the top of the form with a number of records below as in a spreadsheet.
A Form layout places the field labels to the left of the fields. Generally only one record is displayed at a time.
For this example, choose a Form layout and click on the Next button.
In the following dialog box, type a title for the frame (around the data block) and check the option to include a scroll bar.
The number of records displayed for a Form layout should be 1. The number of records displayed in a Tabularlayout can be more than 1.
Click on the Next button and the final dialog box for the Layout wizard will appear.
Click on the Finish button to create the layout. A new Canvas will be created with the new block and all of the form items added in the layout wizard.
At this point the Layout Editor should appear and the new form with the data block will appear.
Tabular Style:
For layout style all the steps are same as "Form style" instead of selecting Form need to select "tabular style".
Previous Next
No comments:
Post a Comment