Using the screen template created earlier, we will create a customer contact screen with the customer information as the main block, and the contact information as a subsidiary block.
Select the Group Information object. Expand it, and select the group to which you wish to add the new screen entity.
Right click on the group and select
Create->Entity.
Click on the Screen
bullet.
Click on the Next button at the bottom right of the screen.
In the Entity Name property, type CUSTOMER_ACTIVITY as the entity name.
Leave the Datasource property set to (use default).
In the Based On property, select SCREEN_TEMPLATE, which is the template that we created earlier.
Leave the Default Mode property set to QBE View.
Leave the Body
Style, Editable Field Style,
Non-Editable Field Style, Lov Style and
Link Style properties set to (from
parent), as these styles will be taken from the SCREEN_TEMPLATE for this
screen.
Click on the Next button at the bottom right of the screen.
In the Block Name property, enter CUSTOMERS as the name of the block.
In the Block Type property, select Standard Block.
Set the Query Type property to Simple Query.
Leave the Datasource property set to (use parent).
In the Table property, select the name of the table or view from which the data will be obtained. Since our datasource is set to use the Oracle 9i database for NDS Applications, we will select the view CUSTMAST_UVW.
Set the Create Heading checkbox to on to indicate that a heading should be created for each mode for this block.
In the Mode
Selection section, set the QBE
and List checkboxes to
on. We
will be creating 3 different blocks for this screen, one for each mode.
The first block is the query block for the QBE and List screens, which
allows users to query customers.
The second block is the List block, which displays a list of customers
based on the entries on the query block.
The third block is the Edit block, which displays a single customer
selected from the list block, and that customer's associated information.
In the Scheme
Selection section, leave the Form
bullet set to on, since this is the main block, and we will be viewing
one record at a time.
Click on the Next button at the bottom right of the screen.
The Adding Fields screen is displayed. Select the columns that you wish to include on the screen.
Click on the name of the column
to select both the Field and Label checkboxes for that column. Do
this for the following columns
CITY
COUNTRY
CUST_ADDR1
CUST_ADDR2
CUST_ADDR3
CUST_NAME
CUST_NO
STATE
ZIP_CODE
A key must be selected to continue. Set the Key checkbox to on for the CUST_NO and ORG_UNIT_ID fields as they are the keys to this view.
Since this block is not returning
data from the database, we do not need to make entries in the Filters
or Ordering and Grouping fields
for this block.
Click on the Next button at the bottom right of the screen.
The Ordering Fields
screen is displayed next. The columns are initially
ordered as they were listed on the previous screen. To
move a field up or down, highlight the desired field by selecting it,
and click on the Move Up or Move Down buttons on the right of the screen.
Move the fields until they are in the following
order:
CUST_NO
CUST_NAME
CUST_ADDR1
CUST_ADDR2
CUST_ADDR3
CITY
STATE
COUNTRY
ZIP_CODE
ORG_UNIT_ID
Click on the Next button when you have finished moving the fields.
The Option to Add More screen is displayed. We need to create the List block next. Set the Add Block or Labels checkbox to on. The entity in its current form will be displayed.
Since we are adding the next block to the main screen
entity, select the CUSTOMER_ACTIVITY entity.
Click on the Add Block button at the bottom right of the screen.
The List block should be named the same as the query block, because the ExecuteQbe() javascript command that takes us from query mode to list mode and restricts the data displayed in the list mode to that which meets the criteria on the query screen requires it.
In the Block Name property, enter CUSTOMERS as the name of the block.
In the Block Type property, select Standard Block.
Set the Query Type property to Simple Query.
Leave the Datasource property set to (use parent).
In the Table property, select the name of the table or view from which the data will be obtained. Since our datasource is set to use the Oracle 9i database for NDS Applications, we will select the view CUSTMAST_UVW.
Set the Create Heading checkbox to on to indicate that a heading should be created for each mode for this block.
In the Mode Selection section, set the QBE checkbox to off and the List checkbox to on, as we are creating the block to list the data returned from the database.
In the Scheme
Selection section, set the List
bullet to on, since multiple records
are being returned to this screen and we wish to have the labels displayed
at the top of the screen and the fields displayed below them.
Click on the Next button at the bottom right of the screen.
The Adding Fields screen is displayed. Select the columns that you wish to include on this screen.
Click on the name of the column
to select both the Field and Label checkboxes for that column. Do
this for the following columns
CUST_ADDR1
CUST_NAME
CUST_NO
A key must be selected to continue. Set the Key checkbox to on for the CUST_NO and ORG_UNIT_ID fields as they are the keys to this view.
In the Filters
property, you could enter code to restrict the data returned from the
table. We want to include all active customers
for the user's current enterprise, so enter the following filters:
where org_unit_id = $$ORG_UNIT_ID$$ and status_code = 'A'
In the Ordering and
Grouping property, you can enter code to determine the order in
which the data is displayed in the screen. We want
the customers to be listed in alphabetical order by customer name, so
the following should be entered:
order by cust_name
Click on the Next button at the bottom right of the screen.
The Ordering Fields
screen is displayed next. The columns are initially
ordered as they were listed on the previous screen. For
blocks using the list scheme, this determines the left to right order
of the fields in the list. The first field is placed
on the far left, and each field after is placed to the immediate right
of the previous field. When there is no more room
left on the block, the fields are moved down to the next row and placement
starts over at the far left..
To move a field up or down, highlight the desired field by selecting
it, and click on the Move Up or Move Down buttons on the right of the
screen. Move the fields until they are in the following
order:
CUST_NO
CUST_NAME
CUST_ADDR1
ORG_UNIT_ID
Click on the Next button when you have finished moving the fields.
The Option to Add More screen is displayed. We need to create the Edit block next. Set the Add Block or Labels checkbox to on. The entity in its current form will be displayed.
Since we are adding the next block to the main screen
entity, select the CUSTOMER_ACTIVITY entity.
Click on the Add Block button at the bottom right of the screen.
There will be two blocks on the edit block. The first block is the parent block, and it will contain the customer information, and should look just like the query block. The child block will contain the customer contact information, and will be added a little later in this example.
Set the Create block similar to pop-list to the CUSTOMERS (qbe,list) block. This will set up the block to be the same as the earlier created qbe/list block. Then, we can just modify the properties for the Edit block.
In the Block Name property, enter CUSTOMERS as the name of the block. Although it is not necessary to name the edit block the same as the query and list block, it gives consistency to the page.
Set the Create Heading checkbox to on to indicate that a heading should be created for each mode for this block.
In the Mode Selection section, set the QBE and List checkboxes to off and the Edit checkbox to on, as we are creating the block to display a single record from the database that will be selected from the List block.
In the Scheme
Selection section, leave the Form
bullet to on, since a single record
will be displayed on this screen, and the labels and fields will be contained
within the same block.
Click on the Next button at the bottom right of the screen.
The Adding Fields screen is displayed. You'll notice that there are fields already selected. These are the fields selected earlier on the qbe/list screen. We need to add to this information for the edit screen.
Verify that the following columns
are selected:
CITY
COUNTRY
CUST_ADDR1
CUST_ADDR2
CUST_ADDR3
CUST_NAME
CUST_NO
STATE
ZIP_CODE
A key must be selected to continue. Verify that the Key checkbox is set to on for the CUST_NO and ORG_UNIT_ID fields as they are the keys to this view.
Since this block is accessed through the list screen,
and is passed restrictions through that link, we do not need to make entries
in the Filters or Ordering
and Grouping fields for this block.
Click on the Next button at the bottom right of the screen.
The Ordering Fields
screen is displayed next. The columns are initially
ordered as they were ordered on the qbe/list screen from which this block
definition was copied. To move a field up or down,
highlight the desired field by selecting it, and click on the Move Up
or Move Down buttons on the right of the screen. Verify
that the fields are in the following order:
CUST_NO
CUST_NAME
CUST_ADDR1
CUST_ADDR2
CUST_ADDR3
CITY
STATE
COUNTRY
ZIP_CODE
ORG_UNIT_ID
Click on the Next button when you have finished moving the fields.
The Option to Add More screen is displayed. We need to create the Contacts block next. Set the Add Block or Labels checkbox to on. The entity in its current form will be displayed.
Expand the CUSTOMER_ACTIVITY entity and select the CUSTOMERS
(edit) block, as we are only adding the contact information to the edit
screen.
Click on the Add Block button at the bottom right of the screen.
In the Block Name property, enter CUSTOMER_CONTACTS as the name of the block.
In the Block Type property, select Standard Block.
Set the Query Type property to Simple Query.
Leave the Datasource property set to (use parent).
In the Table property, select the name of the table or view from which the data will be obtained. Since our datasource is set to use the Oracle 9i database for NDS Applications, we will select the view CONTACT_MASTER_UVW.
Set the Create Heading checkbox to on to indicate that a heading should be created this block.
In the Scheme Selection
section, set the List bullet set
to on, since this is the secondary block, and multiple contacts will exist
for a single parent customer record.
Click on the Next button at the bottom right of the screen.
The Adding Fields screen is displayed. Select the columns that you wish to include in the block.
Click on the name of the column
to select both the Field and Label checkboxes for that column. Do
this for the following columns
CONTACT
E_MAIL
A key must be selected to continue. Set the Key checkbox to on for the CUST_NO and CONTACT_ID fields. The CONTACT_ID field is a key to the view, and we want to link the subsidiary record to the customer record using the CUST_NO field.
In the Filters
property, you could enter code to restrict the data returned from the
table. We want to include only contacts that are
defined as customer contacts, so we enter the following restriction
where cust_contact = 'Y'
In the Ordering and
Grouping property, you can enter code to determine the order in
which the data is displayed in the screen. We want
the customer's contact information to be displayed in alphabetical order
by contact name, so the following should be entered:
order by contact
Click on the Next button at the bottom right of the screen.
The Ordering Fields
screen is displayed next. The columns are initially
ordered as they were listed on the previous screen. To
move a field up or down, highlight the desired field by selecting it,
and click on the Move Up or Move Down buttons on the right of the screen.
Move the fields until they are in the following
order:
CONTACT
E_MAIL
CONTACT_ID
CUST_NO
Click on the Next button when you have finished moving the fields.
The Create Join
screen is displayed next. If you need to create
a join between a field in the master block and a field in the detail block
that were named differently, this is where you would do it. Since
the join is on the CUST_NO field, and they are named the same in both
the master and the detail blocks, you do not need to create a join here.
The Option to Add More
screen is displayed. We have no more blocks to
add, so click on the Finish button.
The new entity is added to the initially selected group.
In the Explorer Tree, the new entity will be displayed,
expanded with all blocks shown.
Click on the Save button in the main toolbar to save the new screen entity.
Now we need to make sure that the correct links are showing up on each mode for this screen.
Right click on the CUSTOMER_ACTIVITY entity in the Explorer
Tree and select Designer Frame
from the menu.
Within the Designer Tool, you can move, align, and resize the objects. For specific instructions on the Designer Tool and its functionality, see the Designer Tool section.
When the Designer Tool
is displayed, expand it so that you can see the entire entity. The
Designer Tool displays the default
mode of the entity selected. The pop-list in the
upper right of the Designer Tool
indicates that we are viewing the lay out of the QBE
View.
Left click on the field that contains the word CUSTOMERS. This is the heading for this block in QBE Mode. Double click to display the property sheet.
In the Contents
property, enter the text: Search Customers.
Click on the Save button in the main toolbar to save the changes.
Some of these fields need to be restricted to upper case, because the data contained in the database is upper case only.
Hold down the Shift key, and in the Designer Tool, select the CUST_NO, STATE, COUNTRY, and ZIP_CODE fields by left clicking on them.
Double click on the ZIP_CODE field to display the property sheet that allows you to modify all four fields at the same time.
Set the Text Case
property to Uppercase.
We can delete two of the three address labels. Hold down the Shift key, and in the Designer Tool, select the Cust Addr2 and Cust Addr3 fields by left clicking on them.
Click on the Delete
Current button in the main toolbar to delete the fields.
The Confirm Delete
pop-up is displayed. Click on the Yes
button.
The Delete Results
pop-up is displayed. Click on the Ok
button.
Repeat for the Cust Addr3 pop-ups.
We need to change the text in the Cust Addr1 label. Left click on the Cust Addr1 label and display the property sheet.
In the Contents
property, type Address.
We need to assign a list of values to the CUST_NO field. Left click on the CUST_NO field to select it and display the property sheet.
In the List of Values property, select CUST_NO.
Set the Enforce Lov
property to false, since this
is a query screen, and they should be able to enter partial queries.
Click on the Save button in the main toolbar to save the changes.
You have complete the change for this screen in QBE Mode. Now we will move onto List Mode.
In the pop-list in the upper right corner of the Designer
Tool, select List View.
First, we need to move the list block so that it is below the query block. In the Designer Tool, click to the right of the CUST_ADDR1 field to select the block.
Then click on the Select Parent button in the toolbar
at the top of the Designer Tool. This selects the
top level container.
Now we need to make the parent block just a little bigger,
so that we can move it around in the Designer Tool. Hover
your cursor over the bottom edge of the block until it turns into a double
headed arrow. Hold down your left mouse button
and drag the edge of the block down.
Now left click in the space that was created. Hold
down the mouse button, and drag the block down so that it's below the
query block.
The list screen should be Display Only, so first, we will mark the database block display only.
In the Designer Tool,
left click in the blank area to the right of the CUST_ADDR1 field to select
the CUSTOMERS block. Double click to display the
properties sheet.
Set the Display Only
property to true.
Click on the Save button in the main toolbar to save the changes.
In the Designer Tool, left click on the field that reads CUSTOMERS_HEADER, which is the heading for the block. Double click to display the property sheet.
For the Contents
property, enter the text List of Customers.
Click on the Save button in the main toolbar to save the changes.
You have complete the change for this screen in List Mode. Now we will move onto Edit Mode.
In the pop-list in the upper right corner of the Designer
Tool, select Edit View.
Some of the left menu links are inappropriate for Edit
mode. Hold Shift down, and select the following
links on the left menu: New
and Delete.
New link because we did not create a new block for this screen,
so we do not want users to have access to the screen in New mode.
Delete link because we only want the user to be able to
modify the customers and contacts, but not delete them from the database.
Double click on the Delete link to display a property sheet that allows you to modify both links at once.
Set the On Edit
property to false.
The left menu will now look like this:
Left click on the field that contains the word CUSTOMERS. This is the heading for this block in Edit Mode. Double click to display the property sheet.
In the Contents
property, enter the text: Maintain Customers.
Some of these fields need to be restricted to upper case, because the data contained in the database is upper case only.
Hold down the Shift key, and in the Designer Tool, select the CUST_NO, STATE, COUNTRY, and ZIP_CODE fields by left clicking on them.
Double click on the ZIP_CODE field to display the property sheet that allows you to modify all four fields at the same time.
Set the Text Case
property to Uppercase.
A few modifications need to be made in the lower block as well. In the Explorer Tree, complete the following steps.
Left click on the field that contains the word CUSTOMER_CONTACTS. This is the heading for this block in Edit Mode. Double click to display the property sheet.
Select the HEADING label. Double click to display the property sheet.
In the Contents
property, enter the text: Contacts.
Select the CONTACT field. It was assigned an automatic hyperlink because it is on a list format block, and it was the first field when we were ordering the fields during block creation. We need to remove the hyperlink and make the field editable.
Display the property sheet. In the Hyperlink
To property, clear the entry.
Click on the Save button in the main toolbar to save the changes.
We want users to be able to enter new contacts for customers as well. Click on the CUSTOMER_CONTACTS block in the Explorer Tree and display the property sheet.
Change the Num New
Rows property to 1.
Click on the Save button in the main toolbar to save the changes.
To test the new screen entity, highlight it by selecting it, and click on the Run button in the main toolbar.
The Preparing to Run screen is displayed. Since
a global variable was defined in the Filtering property, you must define
the value before the screen is run. Enter 100 in
the value field and press the
Run button.
The screen will be run in the browser.
Xephr is a registered trademark of NDS Systems, LC.
Copyright