Search

Join this Blog for direct reference of any post into your inbox. To join just click on "Join this Site" under "Follower" then Login with your Email.*** DECLARATION: I Maintain this Blog for Helping Myself While at Work and Welcome any body Needing Help!!!.*** CAUTION: Using any of the script from this Blog may contain at Own Risk. These scripts May or May not have been Tested.***

Thursday, 21 June 2012

How to Add New Column in Form

Consider this post after the successful creation of your first form employee.fmb and if you require to add new column in already existing canvas. Before starting actual process I am just adding some basic stuff related to form.
There are four main types of forms that can be designed.
1.      Single Block Form:- This form contains a single data block corresponding to a single database table.
2.      Single block Form with lookup field:- This form contains a single data block corresponding to a single database table with the addition of one or more fields that display data from some other tables. Such data is "looked up" when the form runs.
3.      Master/Detail Form:- This form contains two data blocks that are arranged in a master/detail (one to many) relationship.
4.      Master/Detail Form with lookup fields:- This form is similar to the Master/Detail but has the additional lookup fields in the master and/or detail blocks.
Function Keys
F2 : Layout Editor
F3: Object Navigator
F4: Properties Palette
F11: Enter query Mode.
F8 (CLT+F11): Execute Query
CLT+U: Clear Field Items.
Shift +F7: Clear form

Open the layout editor of existing form and choose the Text toolbar and create column (dname) text just after the deptno column of employee block.
Change the properties of dname as:
Name: dname
Enabled: Yes
database item: yes
Canvas: Existing ‘Canvas_name’
Now save the form
Note: Now you are able to store the value in dname through form. Do not forget to add dname in base table.

Alternatively you can you can add new column by setting
Database Item: No
Name: dname
Enabled: Yes
Now write the Post_change trigger on Deptno
BEGIN
SELECT DNAME INTO   :EMPLOYEE.DEPTNAME
FROM   DEPARTMENT
WHERE  DEPARTMENT.DNUMBER = :EMPLOYEE.DNO;
END;
Note: For the second example consider you are having employee and department table
Trigger:
Pre - Fires before an event executed.
Post - Fires after an event executed.
When – Fires in place of execution.
Key-Next – Fires when particular key is pressed.

0 comments:

Post a Comment