CA Plex Tutorial System ENU
CA Plex Tutorial System ENU
For your convenience, CA Technologies provides one site where you can access the
information you need for your Home Office, Small Business, and Enterprise CA
Technologies products. At http://ca.com/support, you can access the following:
■ Online and telephone contact information for technical assistance and customer
services
■ Information about user communities and forums
■ Product and documentation downloads
■ CA Support policies and guidelines
■ Other helpful resources appropriate for your product
Contents 5
Chapter 3: Modifying the User Interface 49
Introducing the Panel Designer .................................................................................................................................. 49
Modifying the User Interface .............................................................................................................................. 50
Design Window ................................................................................................................................................... 50
Property Sheet .................................................................................................................................................... 53
Changing Individual Controls...................................................................................................................................... 55
Changing More Than One Control.............................................................................................................................. 56
Adding Static Text....................................................................................................................................................... 57
Generating and Building ............................................................................................................................................. 58
Chapter Review .......................................................................................................................................................... 59
Index 109
Contents 7
Chapter 1: Introduction
This guide is written specifically for analysts, programmers, managers, and system
administrators. It provides systematic instructions for using CA Plex in a tutorial format.
It requires a familiarity with data modeling concepts and a working knowledge of the
operating environments of CA Plex and the applications you are developing. This tutorial
guides you through the process of creating a simple model from the design stages
through adding data to your finished application.
This chapter provides introductory information about this guide and explains some key
concepts that you need to understand before you start using CA Plex. It also describes
the application that you will build. For additional information about CA Plex, see Getting
Started and the Tutorial for Windows.
You can use any of the following methods to access online help:
■ From a menu command, select the command on the menu. A short description of
the command appears in the status bar.
■ From a dialog, click Help or press F1.
■ From a class library object, select the object in the Object Browser and press
Shift+F1.
■ From anywhere within CA Plex, press F1.
Chapter 1: Introduction 9
Helpful Hints
Helpful Hints
Be sure to look at the end of the current chapter for the Helpful Hints section. This
section gives you additional information or instructions pertaining to the various topics
being covered.
Getting Started
This tutorial shows you how CA Plex automates the software development process as
you create a sample application. The application you create tracks projects, which
consist of various tasks that are assigned to employees. In the process, it introduces a
set of editors that form the core of the CA Plex toolset:
■ Object Browser—Used for viewing the objects in your application
■ Model Editor—Used for specifying design information that CA Plex uses to generate
your application
■ Panel Designer—Used for designing the user interface elements of your application
■ Diagrammer—Used for drawing design diagrams
■ Action Diagrammer—Used for specifying the logical functionality of your
application
Other Tutorials
This tutorial is intended for CA Plex users who are developing for System i (AS/400) 5250
environments. However, you also have the option of working through the following
guides shipped with CA Plex:
■ Tutorial for Windows
■ Java Tutorial (see the chapter "Develop the First Application in 20 Minutes" in the
Getting Started)
What Is CA Plex?
CA Plex is a pattern-based application development tool that works with a variety of
generators to enable you to design, generate, compile, and deploy your business
applications. CA Plex provides the following basic functionality:
You usually use a diagramming tool for this stage; seeing a visual representation of
the objects in your database helps to get a mental picture of your data. Diagrams
enable you to specify entities and their attributes, with relationships between
entities. For more information on the CA Plex diagramming tool, see the chapter
"Diagramming Entity Relationships."
User Interface Design
This stage is usually handled at the same time as the function logic design. In this
stage, you create the panels that the program uses to enable end users to interact
with the data. For more information on CA Plex user interface design tool, see the
chapter "Modifying the User Interface."
Chapter 1: Introduction 11
Getting Started
Concepts Preview
The following sections introduce you to concepts and terms that are essential to
understanding CA Plex. For more information about any of these topics, search for the
term in the online help index.
Objects
The following table presents a list of the different types of objects used in CA Plex
models. The list also contains the corresponding abbreviation, icon, and description for
each object type.
Panel PNL Panels make up the user interface of your application. You
typically inherit panels from libraries, which give you a
general layout, and then make changes to them.
Table TBL Tables are the physical structures where data is stored.
Scope
A scoped object is an object that belongs to another object. When you refer to a scoped
object, you usually use its full name, which includes:
■ The name of the object to which it is scoped
■ A period
■ The object’s own name
For example, if you have an entity called Customer that scopes a function called Edit,
the Edit function’s fully scoped name is Customer.Edit.
A scoped object cannot exist independently of the object to which it is scoped. For
example, a panel that is scoped to a function is deleted when the function is deleted.
Some types of objects are unscoped. This means that they exist independently of all
other objects in the model. For example, diagrams are unscoped.
Conversely, a table is always scoped to an entity. To create a table object, you must
specify the entity to which it belongs.
Chapter 1: Introduction 13
Getting Started
Entity Relationships
You can specify relationships between entities. The two most common relationships are
owned by and refers to (both are used in this tutorial).
owned by
Creates a parent-child relationship. The child entity cannot exist independently of
the parent entity. In the application that you build in this tutorial, the Project entity
is the parent of the Task entity. Tasks cannot exist unless they are part of a project.
Therefore, if the project is deleted, the tasks should automatically be deleted.
refers to\-
Creates a link between entities, but both entities can exist independently. In the
application you build, you create an Employee entity. The Task entity refers to the
Employee entity, by which end users assign employees to tasks. If the task is
deleted, the employee still exists.
Triples
Triples are a special kind of construct that CA Plex uses to record design information
about an application. As the word implies, a triple has three parts: a source object, a
verb, and a target object.
Use triple to define the objects in a model. For example, to define that an Employee
entity has a field that stores an employee’s name, you would create the following triple:
If you wanted Employee Name to be alphanumeric and able to hold 25 characters, you
would enter the following triples:
Important! Notice that the objects and values are not represented with bold text, but
the verb of the triple is. This is the way triples are formatted in all CA Plex
documentation. The verb refers to the relationship you create between the objects, or
between the object and the value.
Inheritance
Another way to assign the data type of character and the length 25 to the Employee
Name field is to enter the following triple:
For example, you could create the following two entities, if you needed to create two
types of Project entities in a project management application. One would represent
projects that were billed by the hour; the other would represent projects that were bid
by job.
Creating two types of Project entries would require a lot of duplicated effort. The
identifier, description, and start and end dates are the same for both entities. Why
should you create all of the functionality for these identical fields twice?
Using inheritance enables you to create a single Project entity with all of the common
structure and functionality, and create two specialized entities that inherit from that
one. Then, you can customize each type of project from there.
Chapter 1: Introduction 15
Project Management Application
The following graphic shows the entities Project Billed By Hour and Project Bid By Job as
they would appear after they have inherited from Project.
Note: The inherited attributes have dashed borders.
For the purpose of this tutorial, the model is very simplistic. If you have developed
project management systems, you may find parts of the model that you would do
differently. Keep in mind that it is only an example.
Look at what this diagram shows about the application. If you have worked with
entity-attributes or entity-relations diagrams before, you can see that:
■ It tracks projects and projects have tasks
■ A project can have more than one task, but a task can only belong to one project
■ A task is owned by a project, which means that if the owning project is deleted, you
will want to delete all of its tasks
■ Employees are assigned to tasks—One employee can be assigned to more than one
task, but each task can only have one employee assigned to it
■ An employee is not dependent on any particular task, which means that if a task is
deleted, the employee assigned to it is not deleted
You can see all of this without having to look at any code or a database schema. This
diagram shows useful information, which CA Plex uses to generate the application. You
will learn how to create this diagram in the chapter “Diagramming Entity Relationships.”
Chapter 1: Introduction 17
PLEX--CA Plex- A First Look
Opening CA Plex
1. Click Start, Programs, CA, CA Plex r7.0, and click the CA Plex icon. CA Plex opens.
This graphic shows you the different ways you can position toolbars. You can dock
toolbars just below the menu, on either side, or set them to float in the workspace.
4. If you need to stop working on this tutorial before reaching the end of the current
lesson, you can save it by clicking the Save toolbar button. You are also prompted to
save your changes when you close certain editors after making changes.
Note: When the editors prompt you to save, only the changes made in that editor
are saved and not the whole model.
Closing CA Plex
From the File menu, click Exit to close CA Plex.
The options you specify for a model are stored in a file in the same directory as the
model. It has the same name as the model, but has a .bld extension (in the case of this
tutorial, the build file is Tutorial5250.bld).
Before continuing in this section, ask your System i Network Administrator what type of
connection you will make to the System i server (TCP/IP), and get the following
information. For TCP/IP connections:
■ A fully qualified network address
Such as myAS400.local.mycompany.com
■ Server port
■ Code page
■ User name
■ Password
The following steps outline how to set up a TCP/IP connection. The process involves
three main steps:
1. Creating a System i system.
2. Specifying settings for the system.
3. Indicating that the model should use the newly created system when building for
the System i 5250 environment.
Chapter 1: Introduction 19
Setting Up Generate and Build Options
3. Click the Generate and Build Options toolbar button. The Generate and Build
Options dialog opens:
4. Click Set Defaults. The Set Build Directory Defaults dialog opens:
Chapter 1: Introduction 21
Setting Up Generate and Build Options
Note: You should have created the YTUTORIAL library on your System i during the
CA Plex installation process. For more information, see Getting Started
6. Click OK. The Generate and Build Options dialog opens.
7. To assign the Source directory location as the default location of the generated
source directories, Click Apply Defaults.
8. On the left pane of the dialog, select System Definitions. The display changes:
10. Type your system name in the System Name field. Remember that you received this
information from your System i network administrator before starting this process.
Make sure System i is selected in the System Type field, then click OK.
11. The new system name appears in the Generate and Build Options dialog. Now that
you have created a System i system, you need to specify its settings.
12. Select the system name you just added and click Properties. The System Properties
dialog opens.
13. Change the Job Description Name to QBATCH, and the Job Description Library to
YTUTORIAL.
Chapter 1: Introduction 23
Setting Up Generate and Build Options
14. Make sure that the Hold on Job Queue check box is not checked and that the Job
Priority value is set to 5.
15. In the left pane, select the AS/400 Configuration option. The System Properties
dialog changes:
16. In the Protocol section, enter the appropriate information in that option’s section.
17. Click OK to close the System Properties dialog.
Now that you have created a system definition, you must indicate that CA Plex is to
use that system when generating and building for the System i 5250 environment.
18. Click OK again to exit the Generate and Build Options dialog.
Chapter 1: Introduction 25
Chapter 2: Defining Entities
In this tutorial, you create an application that stores information about projects, the
tasks they contain, and the employees assigned to each task.
In this lesson, you define what a project is, and what you want to store about each
project. You use the CA Plex Class Libraries to streamline the process.
In this lesson, you create an entity called Project. The Project entity uses fields to store
information about itself, such as its start and end dates. You define functions to enable
end users to create, modify, and delete projects. Entities, fields, and functions are all
types of objects. For more information on definitions of the various object types, see
Objects in the chapter “Introduction.”
To open the Object Browser, choose Object Browser from the Tools menu, or click the
New Object Browser toolbar button. By default, CA Plex opens an Object Browser when
you open a local model, even if an Object Browser is already open.
The Object Browser is the bucket that displays all of the objects in a model. In it, you can
see the available library objects, and the objects that you define in your model (you will
define objects in your model later in this chapter).
A library is a collection of objects that you import into your model. CA provides a set of
class libraries with CA Plex; in this tutorial, when you see the term library, it refers to
those libraries. However, any model that you import into your model is a library.
You can keep the Object Browser open while you work and use it as a palette from
which to drag the objects you need. When it overlaps other CA Plex windows, it always
appears on top.
You select which type of object you want to view in the Object Browser (you see one
type of object at a time). Notice that the Object Browser has shortcut buttons for
displaying entities, fields, and functions. Setting the Object Browser to display functions
only displays unscoped functions. Functions that are scoped to another object (such as
an entity or a view) are displayed only when the Object Browser is focused on that
object type.
You can use the object list to specify which type of object you want to see. If the Object
Browser is empty, click the Show/Hide Library Objects button to show the library
objects. The button appears on the toolbar and Object Browser.
You can tell that an object is a library object because, by default, it has the library name
in front of the object name. For instance, the fourth entity in the preceding graphic is
OBAS400/Entity With Direct Format, which means that this entity comes from the
OBAS400 class library.
In CA Plex, you specify relationships between objects in a model using triples. A triple is
comprised of three parts: the source object, verb, and target object.
For example, in this tutorial, you use the following triple to define a unique identifier for
the Project entity:
The triple is an instance of the abstract triple ENT known by FLD. Whenever you want to
designate a unique identifier for an entity, also known as its primary key, you use this
triple, replacing ENT with the name of your entity, and FLD with the name of your key
field.
To open the Model Editor, choose Model Editor from the Tools menu, or click the New
Model Editor toolbar button. You use the Model Editor to view, add, edit, and delete
triples. The following graphic shows you the Model Editor as it appears after you have
completed this lesson.
You just created the triple Project known by Project ID. This triple creates a primary
key for the Project entity. For more information on how to change misnamed
objects, see the section Misnamed Objects in this chapter.
6. If the Object Browser is not open, open it.
7. On the Object Browser, click the Fields toolbar button to display field objects.
8. Project should still appear in the source object field of the Model Editor. From the
verb list, select has FLD.
9. In the target object field, enter Project Description.
10. Press Enter.
You have created the triple Project has Project Description, which defines the field
Project Description for the Project entity. You will use this field to store a
description of the project. This triple, ENT has FLD, creates a non-key attribute. The
values in non-key attributes do not need to be unique to each entity. For instance,
you may have more than one project with the same text in the description field.
11. Repeat Steps 8 and 9 to create the following triples:
Project has Project Start Date
Project has Project End Date
12. On the Object Browser, click the Refresh toolbar button. The Object Browser shows
the new fields:
In the next step, you further define Project’s fields using inheritance. Inheritance is the
mechanism that enables an object to adopt the properties of another more general
object. For more information on this concept, see Inheritance in the chapter,
"Introduction."
By inheriting from class library fields, you enable your application to:
■ Validate data entered in the fields (which ensures that an end user does not
accidentally enter the year in the month position of the Project Start Date field, for
example)
■ Display data to the screen appropriately (such as displaying an underscore to show
how long the Project Description field entry can be)
■ Store data appropriately in the database (creating a text field in the database for
the Project Description field, and date fields for the Project Start Date and Project
End Date fields)
Note: The cursor changes to a closed parcel icon when you are dragging an
object from the Object Browser. It changes to an open parcel icon when it is
over an editor, or any area that can accept the object.
3. From the verb list, select is a FLD.
4. From the Object Browser, drag the library object OBASE/Code to the target object
field, then press Enter.
You just created the triple Project ID is a OBASE/Code. Click the Refresh button on
the Object Browser. Notice that the Project ID field has a plus icon to the left,
indicating that it now has scoped objects.
5. Click the plus icon to expand the field. You can see that Project ID now has the
values *Blank and *Not blank, but you cannot tell much else about what it inherited
from OBASE/Code.
6. Drag the Project ID field from the Object Browser to the body of the Model Editor.
When you drag one or more objects to the body of the Model Editor, the display
changes to show you the triples that define those objects.
7. If you want to make changes to an object and its scoped objects, but do not want to
be distracted by information about the other objects in your model, use this drag
and drop technique. To clear the focus so that all of the model’s objects are again
displayed, click the Clear Focus toolbar button.
When you drag the Project ID field to the Model Editor, it focuses on this field,
showing the triple Project ID is a OBASE/Code. This triple still does not tell you
much.
8. To see more about what an object inherits from its ancestor objects, click the Two
Levels toolbar button. The Model Editor changes to show another level of detail.
Now, you can see that Project ID has inherited a data type of character and a length
of six through the inheritance triple OBASE/Code is a OBASE/Character.
Note: In Step 4, you dragged the library object OBASE/Code from the Object
Browser to the Model Editor to enter it in the target object field. You can actually
type the value into the target object field (without the library name) to accomplish
the same thing.
Important! If you mistype the object name, you are likely to create a new object with
the mistyped name.
9. Change the Model Editor display back to show a single level by clicking the One
Level toolbar button.
10. Reset the Model Editor display by clicking the Clear Focus button.
11. Drag Project Description from the body of the Model Editor to the source object
field.
12. Enter Narrative in the target object field and press Enter.
Notice that the Model Editor displays the triple as:
Project Description is a OBASE/Narrative
This indicates that you correctly spelled the class library field, as the Model Editor
replaced your entry with the library object by the same name.
Note: If you create a new object for a model, and it happens to share the name of a
library object, you must rename your object or delete it (if you did not intend to
create it).
13. By default, fields that inherit from OBASE/Narrative have a specified length of 25.
To enable your end users to specify a longer project description, add the following
triple:
Project Description length 30
14. Now, using either the method explained in Steps 2 through 4, or the method
explained in Steps 11 and 12, create the following triples:
Project Start Date is a OBASE/ISO Date
Project End Date is a OBASE/ISO Date
This inheritance gives the fields an ISO date format and includes built-in functionality to
ensure that the date values end users enter are valid dates.
Use the process described in Steps 7 and 8 to look at the characteristics these fields
inherited from the class library fields.
You again use inheritance to add this functionality. The inheritance triple gives your
entity the objects necessary to display and process a user interface, and to read data
from and write data to a database.
5. By inheriting from Grid Maintained Entity, the Project entity now has some scoped
objects. In the Object Browser, click the Refresh button.
6. The Project entity you just created appears at the top of the Object Browser. Click
the plus sign to the left of the entity icon to expand Project:
You can see that among the objects it inherited are several functions (with scoped
panels) and views, and a physical table. These objects enable Project to display a
user interface, and to store data to and retrieve data from a database.
Specifically:
■ Project.Grid Maintenance Suite.Edit Grid User Interface displays the panel scoped
to it
■ List Panel, which is scoped to the Edit Grid User Interface function, stores the layout
of the Edit Project panel
■ The functions scoped to the views access the database to add, delete, and change
records
You will learn more about panels in Modifying the User Interface, and functions and
views in the chapter "Defining Owned By Relationships."
After you have generated and built the objects in your model, you will be able to run the
program to see what you created.
The Generate and Build window appears. The Message Log pops up when you open
the window. You can ignore its messages for now, and minimize it.
2. If the Generate and Build window shows library objects, turn them off with the
Show/Hide Library Objects toolbar button.
The Generate and Build window now shows only the Project entity:
4. Click the Generate and Build toolbar button. When you click this button, the Project
entity expands, showing all of its scoped objects that can be generated. Those that
will be generated are highlighted.
5. A Confirm Generate dialog appears, indicating the number of objects that are
generated. Not all of the scoped objects are selected. Click Yes.
6. CA Plex generates those objects, and then summarizes the generation process. Click
OK on the summary dialog when the generation completes (until the generation is
complete, the button says Cancel).
Note: Generating these objects causes warnings; one indicates that the length of a
field on a panel differs from its length in the program, and the other indicates that
no event was found for a grid subfile selector value *Blank. Disregard these
warnings, as they do not affect your compiled application.
7. CA Plex prompts you to compile and build the objects. Click Yes both times.
CA Plex then sends the generated code to the System i you specified previously (For
more information, see Specifying Build System Settings). The window shows the
progress of transferring the source code on the Remote Compile dialog.
8. After the code is transferred to the System i server, the server compiles it. Click OK
on the Remote Compile dialog.
9. Click the AS/400 Build Status toolbar button to display the status of your build.
The Remote Job Status dialog appears.
10. Click Refresh until all of the jobs indicate that they successfully compiled.
11. When the build is done, close the Remote Job Status dialog.
12. Save your model.
13. From the Build menu, choose System i Message File, then Generate and Build.
Note: Building the message file generates an error, indicating there was no text for
"Format ODBC time value." Do not worry about this error; it will not keep your
generated application from running properly.
14. From the Build menu, choose System i Field Values File, and then Generate and
Build.
15. Find the function Project.Edit Grid User Interface, in the Generate and Build
window, and note its implementation name (following the object name).
Value Enter
Project ID PROJ01
Value Enter
Project ID PROJ02
Project Description Email client for IS
Project Start Date 030199
Project End Date 040499
Value Enter
Project ID PROJ03
Project Description Chg McCready app to ODBC
Project Start Date 050599
Project End Date 060599
4. Press F3 to exit the Add Project panel. Your main panel should look like this:
For now, do not delete or change any of the projects you entered in the preceding
steps. The following steps show you how to do so.
Deleting a Project
To delete a project:
1. On the Edit Project panel, tab to the grid selector field for the project you want to
delete.
Note: CA Plex uses the term grid for an System i subfile.
2. Enter 4 in the field, then press Enter.
Changing a Project
To change a project:
1. On the Edit Project panel, tab to the field you want to modify (you cannot modify
the primary key field).
2. Type over the existing value with the new value, and then press Enter.
Preserving Data
By default, each time you build your application, CA Plex rebuilds all of the objects you
select in the Generate and Build window, including the tables in your database. Because
rebuilding a database table erases all data in the table, if you leave your local model set
up as it is, the next time you build, you will lose all of the data you just entered.
You can prevent the loss of this data by entering a TBL implement SYS No triple for the
table. This keeps the table from being rebuilt the next time you build the entity to which
it is scoped (in this case, Project).
Remember, if you make any changes to an entity that affect its table, such as adding
fields to it, you must set the implement SYS value back to Yes, and regenerate the table.
Any data you entered in the table will be lost. If you want to preserve data entered after
rebuilding, make sure you reset the implement SYS value to No.
Chapter Review
In this lesson, you:
■ Defined the Project entity
■ Defined fields for the Project entity
■ Set the Project entity and its fields to inherit from class libraries to display a user
interface, validate data entry, and store data in a database
■ Generated, built, and ran the application, adding data to the database
Helpful Hints
This section gives you additional information pertinent to this lesson.
Misnamed Objects
When you mistype the name of a library object, you end up with objects you did not
intend to create.
4. Click OK.
2. Select the object and click the Name toolbar button. The Rename Object dialog
appears:
3. Replace the name in the Name field with the new name.
4. Click OK.
Triples
You spend a lot of time working with triples when creating an application. Here are tips
on how to select, delete, and change triples:
■ To select a whole triple, click the center column of the Model Editor, where the
verb is.
■ To delete a triple, select the triple in the Model Editor and press the Delete key.
■ To change a triple, select the triple in the Model Editor, change the value in the
source object field, the verb list, or the target object field (or a combination of
these), and click the Change Triple toolbar button.
In this chapter, you will use the Panel Designer to fix these problems:
■ You will shorten the column headings.
■ Move the columns closer to each other for easier record reading.
■ Add an entry to the Options area above the columns, in preparation for Defining
Owned By Relationships in which you define the Task entity.
Design Window
The Design Window is the Panel Designer’s main window. Using this window, you can
create or change a window and see how your changes affect the panel’s appearance.
You can select, move, and resize fields and other user interface elements using this
window. When you make visual changes to the panel and its elements using other
windows, the changes appear here.
A panel’s elements are grouped into regions. A region is the equivalent of a DDS format.
The following graphic shows the panel’s main region you use to add and edit projects.
Pane
l Palette
The Panel Palette shows all the elements of the panel, such as fields, labels, and
buttons, which are grouped under folders ( ) and regions ( ). Feel free to expand the
folders and regions to see what they contain. Most of the visible elements are contained
in regions. Notice that you can see the five regions of the Panel Palette:
■ Grid
■ Title
■ Function key text
■ Selector text
■ Pane
When a region is expanded, as the Grid region is in the following example, you can see
the elements contained in that region. In the case of the Grid region, this includes the
Grid Selector, Project ID, Project Description, Project Start Date, and Project End Date
fields.
When represented on panels, fields contain more than one part, including at least one
label and a control. Notice on the preceding graphic that the Project ID field shows both
a column heading and an Edit control. The label indicates whether it is a Left Label, a
Column Heading, or a Right Label. The type of label indicates if it appears to the left or
right of the field (left/right label), or as a column heading. The control is the part that
end users interact with. The settings for the control indicate how it appears.
Property Sheet
The Property Sheet shows you the properties of the elements that you select in either
the Design Window or the Panel Palette, and enables you to change the settings for
those properties. Among other things, you can change color, (in some cases) size, and
position. To see what you can change about an element, select it in the Design Window
or the Panel Palette, and check its properties on the Property Sheet:
The properties you can change depend on the type of element selected. For example,
you can set the Allow Blank property for a field, which determines if a blank field is a
valid entry. But end users cannot enter text for a label, so if you select a label on a
panel, the Property Sheet does not display this property.
To visually indicate that the Project ID field is a key field, you will now change it so that
its text appears in turquoise.
Notice the icons used. The icon represents a region. Remember, a region is an
area of a panel, and that there are five regions on this panel. In this chapter, you
make changes in the Grid region, which is the section that displays the four fields
you defined in Getting Started in the chapter "Your First Application in 20 Minutes."
The icon represents a field. You expand the field icon to view or select the
components (controls and labels) of the field.
The area at the top may display as an edit box, edit box with a Three Dots button, or
a combo box (as in the previous graphic), depending on the property.
6. From the combo box displayed at the top of the Property Sheet, choose Turquoise.
Next, you will modify the properties of the fields in the Grid region.
4. Repeat Steps 2 and 3 to add the word Project to the other three labels.
5. Click the Save toolbar button to save the changes in your model without closing the
Panel Designer.
Note: While dragging the cursor, it may change to a symbol indicating that the
fields cannot be dropped where you have positioned them. Move the mouse down
a bit and the cursor should return to normal.
The Design Window should look like this:
3. Repeat this process to move the Project End Date field so that it has only a single
space between it and the Project Start Date field.
4. Keep the Panel Designer open for the next section.
2. Enter 5=Work with tasks in the Name field. Then click OK.
3. Select the new static item under the Selector text region in the Panel Palette.
4. Notice that, in the Design Window, the selected static text is behind the text at the
top of the region. Drag the static text down and to the right so that it is to the right
of 4=Delete.
5. Your panel should look something like this:
Because you only modified the panel scoped to Project.Grid Maintained Entity.Edit Grid
User Interface, you do not need to generate the entire project. Open the Generate and
Build window, and select Project.Grid Maintained Entity.Edit Grid User Interface. Then,
generate and build this function. Doing so generates and builds both the function and
the panel scoped to the function.
Chapter Review
In this chapter, you:
■ Learned about the three windows that comprise the Panel Designer
■ Changed panel formatting to distinguish key values from non-key values
■ Changed field labels
■ Moved fields in a region so that the panel looks better
■ Added static text to a region
With the project management application you are designing, the real-world entities
map quite easily into database objects. The application tracks projects, the tasks that
make up those projects, and the employees that are assigned to those tasks. Each of
these is represented by one entity.
Note: Entity Attributes (EA) diagrams in CA Plex are a little bit different than they are in
other applications. EA diagrams typically only display entities and their attributes, but in
CA Plex, relationships between entities are also displayed.
In CA Plex, EA diagrams provide a visual representation of the entities that are stored in
a database, their attributes, and the relationships between the entities. Diagrams
enable you to visually communicate the specifics of an application to other developers
or business analysts, and in some cases, to your end users.
The following example shows what your EA diagram will look like when you finish this
chapter:
Together, two nodes, and the link between them, or a node and its sub-node, are
equivalent to a triple in an CA Plex model. For example, you can see in the preceding
graphic that the Project entity has four sub-nodes: Project ID, Project Description,
Project Start Date, and Project End Date. These correspond to the following triples,
which you created in the chapter "Defining Entities:"
When you define and change objects using the Diagrammer, your changes are reflected
everywhere in the model (just as if you had used the Model Editor or another editor to
make the changes). Similarly, if you delete a triple in the Model Editor, any
corresponding links on diagrams are also removed. But the opposite is not true. If you
delete a link using the Diagrammer, the triples created when you created the link are
not deleted.
For the purpose of this tutorial, however, use the Diagrammer to define the remaining
two entities, their attributes, and the relationships among all of the entities.
Creating a Diagram
CA Plex supports many types of diagrams (including diagram types that you can make
yourself), but this tutorial only shows you how to create an Entity Attributes diagram.
3. In the Object Browser, select Diagram from the object type list.
4. Select Project Diagram from the list, and click the Editor button on the Object
Browser.
The diagram opens with the Select Diagram Type dialog on top:
The asterisk indicates that the object has attributes that the diagram can show.
Next, you will change a diagram setting so that it shows the attributes of all entities
represented by it.
8. From the Layout menu, choose Always Show Sub-Nodes.
Notice that the node automatically resized to show all of its attributes.
The Project ID sub-node has a lighter color to indicate that it is a key. You will see
later in this chapter how the Diagrammer uses display characteristics to indicate
foreign keys and other special attributes.
Note: When you create a node by right-clicking in the diagram, the node appears
where you click the mouse.
3. Type Task and click OK.
Note: The Task node appears where you clicked your mouse.
4. Move your mouse to the lower-right corner of the diagram and repeat Steps 2 and
3 to create a node for the Employee entity.
Your diagram should look something like this:
3. Notice that the sub-node is not contained within the Task node. Right-click the Task
node and choose AutoLayout from the pop-up menu.
The AutoLayout function enlarges parent nodes so that they can hold all of their
sub-nodes. It also organizes the sub-nodes within the parent node. In this case, it
enlarges the Task node, and puts the Task ID node inside it.
Note: When right-clicking entity nodes, make sure you are clicking the parent node,
and not any of its sub-nodes.
4. Right-click the Task node, choose Create Sub-Node, and then Attribute from the
pop-up menu.
5. Name the sub-node Task Description.
6. For the Employee entity, repeat Steps 1 and 2 to define a primary key called
Employee ID, and Steps 4 and 5 to define the following non-key attributes:
■ Employee Name
■ Employee Billing Rate
■ Employee Email
■ Employee URL
7. Select the Employee and Task nodes and use Auto Layout. Make sure that each
entity is in a corner of the Diagrammer window.
In your application, a task is part of a project. Therefore, if you delete a project, you
want all of its tasks deleted. Because of this, you define Project as the owner of Task; so
that each task is directly related to the project it is part of. This is known as an owned by
relationship, which is sometimes referred to as a parent-child relationship.
When you define a task for a project, you must specify an employee who is responsible
for completing the task. Because an employee can be assigned to more than one task, in
more than one project, you do not want to delete the employee record if you delete a
task. So, you define a refers to relationship between the Task and Employee entities.
Note: The link shows a one-to-many relationship between the two entities. This
indicates that a project can have many tasks, but that a task can belong to only one
entity.
5. If the label owned by is not visible, you can turn on label display by clicking the View
menu, Display Link Labels, Link Names.
6. If the link label appears on top of one of the nodes, click the label to select it (the
cursor looks like this when a link label is selected), and drag the label to a more
appropriate location.
Next, you will focus the Model Editor on the Task entity, which shows that a triple
was added to your model when you created the owned by relationship between
Task and Project.
7. Set the Object Browser to display entities. If you do not see the Task entity, refresh
the Object Browser.
8. Drag the Task entity from the Object Browser to the bottom section of the Model
Editor. This shows all of the triples associated with the Task entity.
Notice that creating the relationship between the Project and Task entities created
the triple Task owned by Project.
9. Click the Clear Focus toolbar button. Clearing the focus in the Model Editor causes
the editor to show all triples in the model.
Next, you will define the refers to relationship between the Task and Employee
entities.
Note: The two foreign keys have dashed borders. The Project ID node is displayed in
the same color as the Task ID node, as it becomes part of the Task entity’s key
(because it results from an owned by relationship). This type of attribute is usually
called a parent key because it is the key of the parent entity. The Employee ID node
is darker because it is not part of the Task entity’s key.
7. Close the Diagrammer. Click Yes to save your changes.
These fields may require more than 25 characters to store the whole name, email
address, or URL. One of the powerful aspects of inheriting from class libraries,
though, is that you can change the default values.
3. Add the following triples to increase the field lengths (the numbers are displayed in
red because they are literal values):
Employee Name length 40
Employee Email length 50
Employee URL length 50
By adding these three triples, you effectively changed the database schema, the
user interface, and all of the processing for these values to use a different length for
each field.
4. Add the following triple:
Employee Billing Rate is a OBASE/Price
Inheriting from Price causes Employee Billing Rate to store a number with two
decimal places.
Notice that Employee inherited the function Maintenance Suite, which has the
functions Change User Interface, Create User Interface, Delete User Interface, and
Maintenance UI scoped to it, each of which scopes a panel object. These four
functions display panels on which end users can add, change, and delete Employee
data. You will see how the functions interact when you generate and build the
Employee entity at the end of this chapter. (You will not use the two print functions
in this tutorial.)
5. Add the following triple:
Employee is a OBASE/Referenced Entity
This gives Employee functionality that enables end users to select from a list of
employees to assign to a task. This is covered in more detail in the following
section.
The inheritance triples you created in the previous steps gave the Employee entity the
following:
■ Functions that let you add, change, and delete employees
■ Ability to access a list of employees from the panel that lists tasks
Refers to Relationships
A refers to relationship indicates that an instance of one entity stores the key value of
one or more instances of another entity. In the application you are building, this is
represented by assigning employees to tasks; the task stores the primary key value of
the employee. An employee can be assigned to more than one task, even to more than
one task in more than one project, but a task can have only one employee assigned to it.
A refers to relationship differs from an owned by relationship in that you do not want
employee records to be deleted when a task is deleted, as an employee can be assigned
to other tasks. However, a task should be deleted when its owning project is deleted, as
a task is merely a subset of a project.
End users can select an employee from the list, which puts the corresponding ID in the
Employee ID field on the Task panel. This keeps your end users from having to memorize
potentially cryptic Employee ID values (such as Emp03), instead letting them pick by
name, email address, or some other criterion.
You will be able to use this new functionality at the end of the next section.
Modifying Panels
In this section, you learn how to use the Panel Designer to make another type of
change. You change Employee.Maintenance Suite.Maintenance UI.List Panel and
Employee.Select Instance User Interface.List Panel so that they only display a few of
Employee’s fields.
Because users typically use either the Employee ID or Employee Name to identify the
individual, and may use the Employee Billing Rate to decide whom to assign to a task,
you will leave these fields visible.
You are now ready to generate and build the Employee entity. For more information on
the process of generating and building, see the Generate and Build the Project Entity
section in the chapter "Defining Entities."
Open the Generate and Build window and select the Employee entity. Then, generate
and build this entity and all of its scoped objects.
This function lists all of the employees in your database. Because you inherited
attributes from User Maintained Entity, rather than Grid Maintained Entity, you have a
group of functions for maintaining your Employee entity, rather than a single function,
as you did with the Project entity.
To work with employee data, run the Maintenance UI function and then access the
other panels to add, change, and delete employees.
Adding Employees
To add employees to the entity:
1. Press F6. The Add Employee panel appears. This panel is scoped by
Employee.Maintenance Suite.Create User Interface.
2. Add the values for the following employees, pressing Enter between each:
Value Enter
Employee ID EMP01
Employee Name Randy Johal
Employee Billing Rate $45.00
Employee Email [email protected]
Employee URL http://www.anonycorp.com/~rjohal
Value Enter
Employee ID EMP02
Employee Name David Castro
Employee Billing Rate $32.00
Employee Email [email protected]
Employee URL http://www.anonycorp.com/~dcastrol
Value Enter
Employee ID EMP03
Value Enter
Employee Name Martha Kolman
Employee Billing Rate $55.00
Employee Email [email protected]
Employee URL http://www.anonycorp.com/~mkolman
Deleting Employees
To delete an employee from the entity:
1. On the Edit Employee panel, navigate to the Grid Selector column for Randy Johal.
2. In the selector field, type 4, then press Enter.
The Display Employee panel appears:
Changing an Employee
To change information about an employee:
1. On the Edit Employee panel, navigate to the Grid Selector column for the record
you want to change.
2. In the selector field, type 2, then press Enter. The Change Employee panel appears.
Chapter Review
In this chapter, you:
■ Used the Diagrammer to define the Task and Employee entities and their attributes
■ Added triples so that the Employee entity inherits from two more class library
entities: OBASE/Referenced Entity and OBASE/User Maintained Entity
■ Added triples so that the attributes you defined for the Employee entity inherit
from one more pattern field, OBASE/Price
■ Tested the Employee entity user interface function by creating employees
■ Hide fields on panels so that only pertinent information is displayed
These are the same objects that the Project ID and Project Description fields inherited
from.
1. Refresh both the Model Editor and Object Browser, and click the Entity button on
the Object Browser if entities are not already showing.
Notice that the Task and Employee entities are both visible in the Object Browser.
2. Drag the Task entity from the Object Browser to the body of the Model Editor. The
Model Editor should look like this:
These are the triples that CA Plex added to your model when you created the
diagram in the preceding lesson.
3. Add the following triples:
Task is a OBASE/Grid Maintained Entity
You created this same triple for the Project entity. For more information, see Add
Functionality to the Project Entity in the chapter "Defining Entities." It gives Task
basic user interface and database functionality.
4. Add the following triple:
OBASE/Child
This triple gives Task special processing based on its relationship with its owning
entity, Project. You used the Diagrammer to define the triple, Task owned by
Project, which describes the relationship between the entities. For more
information, see Defining Relationships Between Entities in the chapter
"Diagramming Entity Relationships." The Task is a OBASE/Child inheritance triple
provides the Task entity with cascade delete functionality. This functionality causes
all tasks owned by a project to be deleted when the owning project is deleted.
5. Select the Task is a OBASE/Child triple in the Model Editor by clicking in the center
column.
6. Click the Editor button on the toolbar. The Template Editor appears.
You use this dialog to specify the owner of an entity that inherits from OBASE/Child.
Owned By Relationships
Remember, the Task entity in the diagram you created in the chapter "Diagramming
Entity Relationships," had two foreign keys, Employee ID and Project ID:
You can tell by the shading that Project ID is part of the key for Task (with Task ID). This
field was added to the Task entity when you created the triple Task owned by Project. It
was added because it is the key of the owning entity.
The addition of the parent key field means that when creating or accessing a task, the
owning project must be specified.
How does this affect your application? Well, it means that you must provide a way for
end users to specify the owning project when creating or accessing a task. To this end,
you will design your application so that end users can only create and access instances
of the child entity (Task) after selecting an instance of the parent entity (Project).
In your application, you will add a key code to the Edit Project panel. Remember, you
already added the static text for that key code. For more information, see Add Static
Text in the chapter "Modifying the User Interface."
You will add functionality so that when end users open the Edit Project panel and enter
the key code to work with tasks for a project, the Edit Task panel appears. When the
end users add tasks, the Project ID field is automatically populated with the ID of the
project selected in the Edit Project panel:
Next, you add a key code to the Edit Project panel. You then add functionality so that
when an end user enters that key code, the project calls Task.Grid Maintenance
Suite.Edit Grid User Interface, the function that displays the Edit Task panel.
You already added the static text telling the end user what key code to use to open the
Edit Task panel. For more information, see Add Static Text in the chapter "Modifying the
User Interface." In the following steps, you create the logical event that causes the panel
to appear, and then you create a grid selector value for the panel.
A logical event is a construct you define to specify what happens in response to physical
events, such as when the end user presses a function key or enters a subfile option. You
can map a logical event to more than one physical event. For example, you can map a
logical event called ClosePanel to two physical events: pressing Enter or pressing F3.
You create subfile options so end users can enter a value in the subfile option field on
the panel (the left-most field on the Edit Project panel) to perform an action (in this
case, open the Edit Task panel).
The following graphic shows you the Edit Project panel with a 5 in the subfile option
field for the first project.
Note: CA Plex uses the term grid selector for the System i subfile option.
2. Right-click the List folder, and choose Create Value from the pop-up menu.
3. A subfile option value, called Value, is added under the List folder. Select the new
value:
Value Enter
Text 5=
Event Modify Tasks
Value Five
window
Variable palette—Select the variables created for the function from this palette
Variable Palette
The Variable Palette is used to view and edit the variables available to a function. In this
window, you can see both real and inherited variables, and also add fields to them.
Basic Concepts
Instructions on using the Action Diagrammer to its full potential are beyond the scope of
this tutorial, but understanding the following concepts will be helpful when using this
editor.
Functions
Functions are objects you create to perform the activities, processes, and procedures
that constitute the functionality of an application. Functions can:
■ Display panels and control how end users interact with the user interface
■ Create, read, update, and delete records in the database
■ Perform calculations
■ Interface with external procedures and programs
Constructs
Constructs are the vertical brackets that enclose instructions or other constructs. They
correspond roughly to the levels of indentation that you typically use with third
generation languages, such as C++. You can create complex structures with constructs.
The following diagram shows you two constructs, one embedded in another.
Statements
Statements occupy one or more lines of the action diagram and cause an action or set of
actions to occur. For example, the Call statement calls a function from another function.
When you modify or add to inherited functions, you can only make changes and
additions in certain places, called collection and edit points. These are places that the
ancestor function indicated are appropriate for new instructions.
Events Handlers
Each function that has a panel scoped to it has an Events Handler. This is a type of
switchboard that processes all of the events a function recognizes. It calls various
subroutines in response to the events that are triggered (such as the Modify Tasks event
you created earlier in this chapter). Later, you will add processing to support the Modify
Tasks event to the Events Handler in the Project.Grid Maintenance Suite.Edit Grid User
Interface action diagram.
Adding Functionality
1. In the Object Browser, right-click Project.Grid Maintenance Suite.Edit Grid User
Interface and choose Editor.
The action diagram opens, with the Select Edit Point dialog over it. Before you can
make a change or addition to a function, you must specify where you want to make
the change. This dialog enables you to select the edit or collection point into which
to insert new constructs.
2. To define your events in the Events Handler, select the post point after Edit Point 1
Additional events (which is under Edit Point 0 Additional events).
3. Now, you can see the three windows that make up the Action Diagrammer.
If these windows overlap, drag or resize them so that you can work with all of them
at once.
The Action Diagram Palette is a container for all the instructions you can use in an
action diagram, grouped by similarity. The Panel folder holds all of the syntax
elements you use when working with panel functionality.
In the Events group, notice the Modify Tasks logical event. You previously created
this earlier in the chapter; see Creating a Logical Event.
5. Drag the Modify Tasks logical event from the Action Diagram Palette to the input
line at the top of the main window.
The main window automatically adds the text Event: to the line when you drop the
event, indicating that you are adding the functionality for an event.
6. Press Enter. The Action Diagrammer adds the statement in the input line to the
body of the Action Diagram:
You specified that the function will do something when the Modify Tasks logical
event is triggered. Next, you specify what the function does.
7. From the Object Browser, drag Task.Grid Maintenance Suite.Edit Grid User
Interface to the input line of the Action Diagrammer (make sure you are dragging
from Task, and not Project).
This time, the Action Diagrammer adds the syntax "Function: " to input line, so that
the function calls the Task.Grid Maintenance Suite.Edit Grid User Interface function
when the logical event is triggered.
8. Press Enter. The Parameter Mapping dialog appears:
When you call one function from another, often you need to pass information. In
this case, when you call the function Task.Grid Maintenance Suite.Edit Grid User
Interface, you need to tell it which Project is selected in the Edit Project panel so
that Task.Grid Maintenance Suite.Edit Grid User Interface knows which tasks to
display on its panel.
Next, you indicate which variable in the Project.Grid Maintenance Suite.Edit Grid
User Interface function to map it to.
9. Click Map Parameter. The Select Field dialog appears. This dialog shows you all of
the values CA Plex could use for the Project ID field. Because you want to see the
tasks assigned to the project that an end user selected on the Edit Project panel,
you choose a Project ID field that comes from the grid on that panel.
10. Select the Project ID field that appears below the Grid entry and click OK. This
indicates that the function will use the Project ID selected in the Grid region on the
Edit Project panel to determine which tasks to display.
11. Click OK on the Parameter Mapping dialog. The Action Diagrammer appears. The
Action Diagrammer should look like this:
Note: If you need to change the parameter mapping in the future, open this action
diagram and double-click the Call line.
12. Close the Action Diagrammer and save your changes.
13. Save your model.
4. Press F6 to open the Add Task panel. The Add Task panel appears. This is the panel
scoped to Task.Grid Maintenance Suite.Create User Interface.
Notice that the Project ID field is already filled.
Value Enter
Task ID TASKA
Task Description Create a data
The third field you need to fill, Employee ID, requires an exact match to the ID for
the employee to whom you want to assign the task. However, you may not know to
whom you want to assign a task or an employee’s ID, so perform the next step.
6. Navigate to the Employee ID field and press F4. The List Employee panel appears.
Remember, you already changed this panel to hide the Employee Email and
Employee URL fields, for more information, see Hiding Fields on Panels in the
chapter "Diagramming Entity Relationships."
7. Navigate to the grid selector field for Martha Kolman and enter 1.
8. Press Enter. The Add Task panel reappears with the Employee ID filled in:
Value Enter
Task ID TASKB
Task Description Verify model with clients
Value Enter
Employee Martha Kolman
Value Enter
Task ID TASKC
Task Description Decide which libs. to use
Employee Martha Kolman
11. Press F3 to close the Add Tasks panel, and again to close the Edit Task panel.
12. On the Edit Project panel, type a space to remove the 5 from the grid selector
region for PROJ01.
13. Navigate to the grid selector field for PROJ02 and enter 5.
14. Press Enter, then enter the following tasks for this project:
Value Enter
Task ID T130
Task Description Architect email module
Employee David Castro
Value Enter
Task ID T131
Task Description Test email functionality
Employee David Castro
Chapter Review
In this chapter, you:
■ Defined the Task entity.
■ Defined restrictor processing for Task, so that its panel only displays tasks that
belong to a single project, and so that it automatically populates the Project ID field
for new tasks.
■ Added a grid selector value to the Edit Project panel, so that users can access the
Edit Task panel from the Edit Project panel.
■ Created a logical event for the grid selector value, and mapped it to a physical
event.
■ Added logic to an action diagram to specify functionality for the logical event. In
doing that, you mapped parameters for a function call.
■ Tested your application to see the changes you had made.
Helpful Hints
The following information offers you hints that are helpful when defining Owned By
relationships.
You had already specified the owner in the Task owned by Project triple. Why did you
seemingly have to specify the owner a second time?
The answer is that you did different things to the model each time you specified the
owner. Adding the triple Task owned by Project gave Task an additional key field—Key
of Project. That is all that happened when you added that triple. The owned by triple did
not add any functionality to Task.
Task is a OBASE/Child gave Task functionality. Specifically, when you inherit from
OBASE/Child, you get the ability to:
■ Read only the task records for a specific project (known as restrictor processing).
For more information, see Defining Restrictor Processing earlier in this chapter.
■ Delete all of the tasks for a project when you delete the project.
However, the functionality that you inherit is abstract. That is, it does not know what is
in your model. The pattern entity, OBASE/Child, uses an abstract entity, called Parent, to
represent the owner. For the pattern to work correctly in your model, you have to
replace this placeholder with the entity you want to be the owner. That is why you
create the replacement triple.
Now you have an application with panels that enable you to add projects, add tasks to
projects, add employees, assign employees to tasks, and access tasks for a project. In
this chapter, you will tie all of the panels together with a top-level menu.
9. Add the following logical events to the panel. For more information, see To Add a
Logical Event to the Edit Project Panel in the chapter "Defining Owned By
Relationships."
Work with projects
Work with employees
10. Add the grid selector values 1 and 2 to the panel, and associate them with the
corresponding logical events. For more information, see Creating a Subfile Option in
the chapter "Defining Owned By Relationships."
Instead of adding them under the Grid region’s menu selector field, you add them
under the Selector text region’s menu selector field.
11. Close the panel and save your changes.
12. Edit the function Project Manager.MDI Frame Processing so that the application
calls the function Project.Grid Maintenance Suite.Edit Grid User Interface when the
Work with projects logical event is triggered. For more information, see Adding
Functionality to Logical Events in the chapter "Defining Owned By Relationships."
Choose the post point that follows the 0 Additional Events edit point.
13. Click in the Action Diagrammer under the construct you just created. The Action
Diagrammer should look like this:
14. Add another instruction to the function so that it calls the function
Employee.Maintenance Suite.Maintenance UI when the Work with employees
logical event is triggered.
When your action diagram is finished, it should look like this:
Chapter Review
In this lesson, you:
■ Created a top-level menu structure
■ Tested the completed application
■ Saw the fully functioning application that you created working
E P
entity • 12 panel • 12
entity relationships • 14 panel designer • 10, 49, 50, 53
design window • 50
F panel palette • 50
field • 12 Property Sheet • 53
FLD • 14, 33 platforms, deploying to multiple • 10
is a FLD • 14
length NBR • 33
S
type SYS • 14 scoped objects • 13
function • 12 deleting • 13
software development process • 11
G
generators • 10
T
table • 12
I Task entity • 83, 84, 85, 97
inheritance • 14, 33, 71 adding key value • 85
and employee’s fields • 71 defining • 83, 84
and project’s fields • 33 attributes • 83
Inheritance, and Task’s fields • 83 inheritance • 84
testing • 97
O triples • 14, 30, 48
defined • 14, 30
OBASE/ • 14, 33, 71, 73, 83, 84, 103
working with • 48
Child • 84
tutorial overview • 10
Code • 71, 83
Default Objects.MDI Template • 103
Index 109
U
unscoped objects • 13
V
value • 12
verbs, defined • 14
verbs. See also triples • 14
view • 12