Topics: Hands-On 01: Tab canvas, Master-detail
relationship
Create an easy to
use data entry Form for your client, for an order entry system they wish to have
developed.
Working with you,
the User has requested a more robust application. Create a Form that contains
three tabs for each Entity. The tabs should be labeled as "Customers", "Orders",
and "Items."
In this Hands-On,
you will learn how to: Use tab canvas, Master-Detail relationship.
|
More Resources by
Google: |
|
|
|
|
Collapse the
customer data entry Form.
Select “FORMS” and
click on the "create" icon.
Choose the “File”
option, then select “save as” to store the form in the "iself" folder.
Name it,
"customer_orders."
Select "data
blocks" and click on the "create" icon.
Use the “Data Block
Wizard” option.
Click “OK”
Click "Next."
Click on "Browse";
and select the "customer" table and then “OK.”
Select all columns.
Click on “NEXT” and
then "Finish."
Use the "Tab
Canvas" type with a “new tab page”, then click “NEXT.”
Select all the
columns.
Click “Next.”
Click “Next” again.
Next.
Type the "Frame
title" and then click “next” and “finish.”
This is the form
layout.
Collapse the
customer “data blocks.”
Create a new tab
page for the customer's order.
Select “Data
Blocks” and click on the "create" icon.
Click “OK.”
Then "Next."
Type the table name
"ord."—for the order table.
Then "refresh."
Select all columns;
then click "next."
Click "create
relationship" to establish master-detail relationship.
Click “OK;” and
unmark "Auto-join data blocks."
Then click "Create
relationship" and “OK.”
Use “Customer” as
the Master table and click “OK.”
Change "detail
item" and "master item."
This is the
relationship.
Change "tab page"
to "new tab page” and click "next."
Select all columns
and then deselect “custid.” Since the customer is known.
Use "tabular" since
there are more than one order for each customer.
Type "Title";
“Records Displayed”; and checkmark “Display Scrollbar.”
Now, there are two
canvases: One for customer information and the other for their orders.
Collapse these two
"data blocks."
Select "Data
Blocks" and create a new “data block.”
Choose the same
options.
Click on “Browse.”
And select the “item” table.
Select all columns.
Un-checkmark
"Auto-join data blocks;" and click on "create relationship" and then “OK.”
Use the order
(“ORD”) table as the Master table.
Establish master
and detail relationship.
Remember always you
can delete the relationship and create it again.
Select "new tab
page," then click "next."
Select all columns
except the order ID column (“ordid”), since the order is known.
Select "tabular,"
since there are more than one item in an order.
Type “Frame Title,”
“Records displayed” and checkmark “Display Scrollbar.”
Navigate through
the tab pages. Notice that page3, 5, and 7 don't mean anything.
Select page3, right
click and open its "property palette."
Change the “name”
and “label” to customer.
Press the enter
key.
Notice! The name
always changes to upper case.
Click on page5 to
replace its properties and do the same for “Orders.”
Be sure to press
the enter key to confirm the changes.
Click on page7 to
replace its properties and do the same for “Items.”
Then close the
window.
Now, the tabs are
more meaningful.
Navigate through
the tab pages.
Collapse the
objects to view items easier in the ”object navigator” window.
Select
“customer_orders,” and right click to open its "property palette."
Change "First
Navigation Data Block" to “Customer.”
Close the window.
Click on the "Run"
icon to compile and execute the module.
Click "execute
query" to query the customer information.
Navigate through
the “tab” options.
On the "orders"
tab, select an item.
Notice on the
“items” tab, all its items correspond to the selected order.
Repeat this.
On the customer
tab, position the cursor on “Customer ID” and navigate through the table by
clicking on “NEXT Record.”
Do the same for the
previous record.
Click on "Enter
Query.”
Type 106, and click
"Execute Query."
Navigate through
the customer’s orders and its items.
Close the window.
Save the changes.
Remove the layout
screen.
Remove the
“customer_de” program.
Practice to
collapse and expand an object in the “object navigator” window.
Then remove the
customer_orders Form.
Click yes, to apply
the changes.
Practice to open
the Form from the “iself” folder.
Now, you should
practice this over and over, until you become a master at it.
Good Luck!
|