Exercise - JDELIST

Exercises – DAY 1
Find / Browse Form Exercise:
Purpose is to create an address book application. This application will have one Find/Browse Form and one
Fix/Inspect form.
Learning Objectives:
After completing this exercise, you will be able to:
 Create Table
 Create Business View
 Create a UDC
 Create an application
 Select a Find/Browse Form Type
 Attach Business View to the form
 Select Form Properties and Form Options
 Set focus on the form and the grid
 Add form and grid fields
 Move and size controls
 Add filter fields
 Add Menu/Toolbar exits
 Test a form
1.
2.
3.
Create a new project DME0005
Create a new table F5501010 (Class Address Book Master)
a. Column Prefix: AB
Use following DD Items.
a.
b.
c.
d.
e.
f.
AN8 (PK)
AT1
ALPH
ADD1
ADD2
CTY1
g.
h.
i.
j.
k.
l.
ADDS
ADDZ
ACTIVEYN
CTR
AC01
SAL
Create a new table F5501011 (Class Phones)
a. Column Prefix: PH
5. Use following DD Items
a. AN8 (PK)
e. PHTP
b. LNID (PK)
f. ALPH
c. AR1
g. USER
d. PH1
h. PID
6. Create a new Business View V550101 (Class Address Book – All Columns)
a. Base this Business View upon F5501010
7. Create a new Business View V550102 (Class Phones – All Columns)
a. Base this Business View upon F5501011
8. Create a UDC 55/RE (Region). The Code length should be 2
a. CE
Central
b. NE
Northeast
c. NW
Northwest
d. SE
Southeast
e. SW
Southwest
9. Create a new application P5501001 (Class Address Book)
10. Select Find/Browse Form
11. Give this form the title “Work With Addresses”
12. Attach Business View V550101
m.
n.
o.
p.
q.
USER
PID
JOBN
UPMJ
UPMT
i.
j.
k.
JOBN
UPMJ
UPMT
4.
13. Add Search Type and Alpha Name as Form Controls by selecting Insert from the Menu bar, then
Business View Fields
14. Change Alpha Name label to Name on both Form and Grid. Change ST to State on Grid
15. Change filter criteria for the two filter controls:
a. FC Search Type should be set to ‘=’
b. FC Name should be set to ‘>=’
16. Align Search Type and Name Controls
17. Attach an associated description to Search Type field on Form Control
18. Give a default value to search type field. The default value should be ‘E
19. Add following Grid Columns from Business view
a. AN8
b. AT1
c. ALPH
d. CTY1
e. AC01
20. Give appropriate descriptions, as shown on the above screenshot
21. Apply UDC override on AC01. Attach AC01 to the custom UDC 55/RE
22. Increase width of the grid columns so that it matches the form illustration.
23. Create a group box around Search Type and Name
24. Add Delete and Add buttons to the tool bar
25. Set the tab sequence
26. Test the form
27. Save the form and Exit
28. Run P5501001 from fast path
CONGRATULATIONS!!! You have successfully created your first Find/Browse Form
Exercise Fix & Inspect Form
After you’ve created the Table and Business View objects and the Find/Browse Form, which is the
entry point to the application, you will use the Application Design Aid to create a second form used
to maintain the Class Address Book records.
Learning Objectives
Upon completion of this exercise, you will be able to:
 Select a Fix/Inspect Form Type
 Attach a Business View
 Utilize Tab Control
 Add form controls
 Associate Descriptions
 Move and size controls
 Add Data Dictionary fields
 Describe how to distinguish between Data Dictionary field and Business View field on the
form
 Disconnect control text from control variables
1.
2.
3.
4.
5.
 Explain alignment options
Go into the design of P5501001
Select Fix/Inspect form from form types and give the title “Address Book Revisions”
Apply Size to Guide from Layout option
Attach Business View V550101
Create two Tab Controls as shown in the following forms:
Address Book Revisions (Fix / Inspect) Form – Address Tab
Address Book Revisions (Fix/Inspect) Form – Employee Tab
Top of Form:
6.
7.
8.
9.
10.
Add Address Number, Alpha Name and Search Type as Business View Fields
Align Address Number and Alpha Name
Change Alpha Name to Name
Add an Associated Description for Search Type
Create a Group Box
Address Tab Layout
11. Add Address Line 1, Address Line 2, City, State, Postal Code, Country, and Category Code or
(Region) as Business View fields on “Address Tab” page
12. Change Address 2 to Street Address
13. Disconnect and clear the static text from the Address Line 2 control
14. Disconnect the static text from the controls for State and Postal Code so that you can clear the
text and move the controls
15. Change the static text for City to City/State/Postal and move the State and Postal Controls next
to the City Control
16. Add Associated Descriptions for County and Region
Employee Tab Layout
17. Insert Monthly Salary as a Business View Field
18. Add a control for Annual Salary by inserting a Data Dictionary Field. Select Math01 from the
Data Dictionary Browser and rename the Control Description of Math01 to Annual Salary
19. Disable the Annual Salary control by accessing the control properties.
Form Properties
20. Set the Tab Sequence in a logical manner
21. Test the form
Form Interconnect
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
Go back to Work With Addresses Form (W5501001A)
Go to Menu/Toolbar Exits
Go To Event Rules of &ADD Button
Click on Form Interconnect Control
Call P5501001/W5501001B form
Click Ok without passing any value in to data structure
Click Ok again to come out of Event Rules Window
Select &Select option from Menu/Toolbar Exits
Repeat steps 25 and 26
Select GC Address Book parameter from available objects and pass it to FI Address Book Data
Structure
32. Click OK to save
33. Click Ok to close
34. Save and Exit
CONGRATULATIONS!!! You’ve successfully created a Fix/Inspect form
Exercise – Day 2
Event Rule Exercise:
Learning Objectives:






Create conditional If/Then/Else statements
Create assignments
Create Event Rule Logic to hid and show controls based on condition
Use Event Rules to perform calculation
Use System Functions
Place Check Boxes and assign DD Item to those Check Boxes. Put logic behind those
Check Boxes
Steps to complete the exercise
1. Display Monthly and annual salary controls only if the address book record is for an
employee.
2. On an Add, the Employee tab on the form should initially appear like this:
3. If the user enters Search Type of E, the form should display the Monthly Salary and
Annual Salary controls:
4. If a Monthly salary is entered, the annual salary should be calculated automatically:
Hint: This logic needs to occur on multiple events
5. On work with Address Book Form, put logic on an appropriate event, which will put a
‘Yellow’ color on all the lines on Grid that have a search type ‘E’ on it.
Hint: Choose appropriate SYSTEM FUNCTION from available functions in the Grid
System Functions Option
CHECK BOX EXERCISE
6.
7.
8.
9.
Put two CHECK BOXES on Work With Addresses form as shown on the above picture.
Attach both check boxes to DD Item (EV01)
Give appropriate descriptions to the Check Boxes. Such as Display City and Display Region
Put logic so that when ‘Display City’ check box is CHECKED, the column CITY displays on the
Grid. Otherwise it should be hidden
10. Similarly when ‘Display Region’ Check Box is CHECKED, the columns REGION displays on
the Grid. Otherwise it should be hidden
Hint: Choose System Function “HIDE/SHOW GRID COLUMNS” to hide or show the
Grid Columns
RADIO BUTTON EXERCISE
1. Insert two Radio Buttons on W5501001B (Address Book Revisions) form
2. Associate both the Radio Buttons with database item ACTIVEYN
3. Change the title and value for each radio button
a. Active = Y
b. Inactive = N
4. Create a Group Box around the radio buttons
5. Save and Exit
6. Run the application to test
HINTS
To Hide/Display Salary and Annual Salary Fields
On Post Dialogue is Initialized Event, put following code
If FC Search Type is equal to "E"
Show Control(FC Salary)
Show Control(FC Annual Salary)
Else
Hide Control(FC Salary)
Hide Control(FC Annual Salary)
End If
On Search Type Control, Control Exited and Changed/Inline event, put following code
If FC Search Type is equal to "E"
Show Control(FC Salary)
Show Control(FC Annual Salary)
Else
Hide Control(FC Salary)
Hide Control(FC Annual Salary)
End If
To calculate annual salary
On CONTROL: EDIT Salary
EVENT: Control is Exited, put following code
FC Annual Salary = [FC Salary]*12
To put Check Box Logic
On CONTROL:
CHKBOX Display City, EVENT:
Selection Changed, Put following logic
If FC Display City is equal to <Zero>
Hide Grid Column(FC Grid, GC City)
Else
Show Grid Column(FC Grid, GC City)
End If
On CONTROL:
CHKBOX Display Region, EVENT:
Selection Changed, Put following logic
If FC Display State is equal to "0"
Hide Grid Column(FC Grid, GC Region)
Else
Show Grid Column(FC Grid, GC Region)
End If
To put Color Logic
On EVENT:
Write Grid Line-Before, put following logice
If GC SchTyp is equal to "E"
Set Grid Color(FC Grid,
<Yellow>)
End If
<Currently Selected Row>,
<All Columns>,
Exercise – Day 3
Headerless Detail Application:
Learning Objectives:
Upon completion of this exercise you will be able to:
 Create a Headerless Detail Form
 Attach a Business View
 Sort the grid by line number
 Add a filter (no wildcard) for Address Number
 Disable the Address Number control
 Create an auto find on grid
 Add a Delete button
 Call a Message Box Form
 Test the form
NOTE: Refer to the screenshot on next page
1. Create a new Headerless Detail form in P5501001 application (Phone Numbers Revisions)
2. Attach Business View V550102
3. Add Address Number as a Form control
a. Address Number should have a FILTER option of ‘=’
b. Disable this control
4. Create a group box around Address Number
5. Add the following grid columns and give appropriate descriptions to columns
a.
b.
6.
7.
8.
9.
10.
11.
AR1 (Area Code)
PH1 (Phone Number)
PHTP (Phone Type)
LNID (Line Number)
c.
d.
Set grid properties to “AUTOMATICALLY FIND ON ENTRY”
Add “DELETE” button on toolbar
Set form properties to “END FORM ON ADD”
Set logical tab sequence
Test the form
Save the form
Form Interconnect
1.
2.
3.
4.
5.
6.
7.
Go to P5501001 and choose work with Address Book form
Go to Menu/Tool bar
Add a Row Exit from Class Options
Add a User Defined from Class Options and name it “Phones”
Go to Event Rules Window
Connect P5501001/W5501001A form to P5501001/W5501001E form
Pass Address Number value into the data structure (Think which address number value
should be passed in. Is it going to be FC or GC?)
8. Save and close
9. Go back to W5501001E form and assign the FC Address Number to FI Address Number.
Choose an appropriate event to do this.
10. Save and close
11. Test your application. Try to add records in your application. Come back and see if those
records exist.
Using Event Rule Variables for Automatic Line Numbering
Business Purpose:
In the address book application, the phones screen requires line numbers. Up to this point,
when we added phone number, we entered the associated line numbers manually. This time, we
will add logic so that Line ID field will automatically fetch next nember.
Steps to Complete
1.
2.
3.
4.
5.
Focus on W5501001E (Phone Numbers) application
Create a variable LNID (Scope of the variable should be Form)
In the Name box, change the User Name to LineNumberCounter_LNID
Initialize variable on the appropriate event
To initialize variable, create following assignment
a. VA frm_LineNumberCounterLNID = 0
6. Next, as each line is retrieved from the database, check to see if the Line Number of that
record is greater than the value of the variable. If it is greater, assign the value of the Line
Number to the variable. This ensures that the variable will always be equal to the highest line
number in the table before it is incremented by 1 for the final line in the grid. Use
appropriate event. Hint of the code at the end of the Document.
7. Finally, increment the variable by 1 and assign the new value to the next available line. Use
the appropriate event. Hint of the code at the end of the Document.
8. Disable the Line Number control in the grid.
9. Save and Exit the application. Test the application
Create a Message Box Form
1. Go into the design of P5501001 and insert a new Message form from form type and call it
“Confirm Delete”
2. Type the following statement on the Event Rules Title
“You are about to delete phone numbers. Are you sure?”
3. Attach ‘Yes’ and ‘No’ push buttons to the form
4. Go to W5501001E (Phone Numbers Inquiry) form and on the ‘Delete’ Button, call this
Message box form.
5. Save and close the application
6. Test the application
f Search & Select Form
Learning Objectives




Create a Search and Select form
Understand why Search and Select forms usually have their own business views
Attach the Search and Select form to a data dictionary item
Test the form
1. Create a new Business View V550103 (Class Address Book – Search & Select)
2. Attach F5501010 to this Business View
3. Show following columns
a. AN8
b. AT1
c. ALPH
4. Create a new application P550100S (Class Address Book Search & Select)
5. Choose search and select form from form types after you go into the design
6. Attach Business View V550103
7. Add Alpha Name and Search Type as Form Controls
a. Alpha Name should have ‘>=’ filter and Wildcard should be set to ‘Yes’
b. Search Type should have Filter option of = and Set Wildcard to ‘Yes’
c. Align search type and alpha name
d. Add associated description to Search Type
e. Create group box around alpha name and search type
8. Add the following grid columns
a. Address Number
b. Alpha Name
c. Search Type
9. Sort grid by Address Number
10. Set appropriate tab sequence
11. Set the form as ENTRY POINT in form properties
12. Save and Exit
13. Run the application from Fast Path
Note: This application must be checked in so that the Search and Select form is available for the
Data Dictionary Item that it needs to get attached to. As this can’t be done on demo, we may not
be able to test it successfully. But this should give you an idea of how to create a search and
select form.
HINTS
HINT STEP 6:
 Use the form event GRID RECORD IS FETCHED
 Put following logic
If BC Line Number is greater that VA frm_LineCounterNumber_LNID
VA frm_LineCounterNumber_LNID = BC Line Number
End If
HINT STEP 7
 Use the grid event Add Last Entry Row to Grid
 Use the following logic
Va frm_LineCounterNumber_LNID = [VA frm_LineCounterNumber_LNID]+1
GC LineNumber=VA frm_LineCounterNumber_LNID