Organizational chart example

written by tzighi on September 30th, 2007 @ 9:26 PM

In this example we will try to create a application that will allow us to manage a table used for organizational chart purposes. The project definition for this example can be found here and here. Our table will have three fields: Name, Address and one internal ID to act as a unique key. In the end the screen will look something like this:



To accomplish this we must open a new project and fill in the requirements for building up the organizational table. The project screen is divided in three parts:

* The first part is general project data and it holds information about project name, title and author:



First of all let me clarify a little bit the naming procedure. Because iSeries objects can have only maximum 10 characters, we have to be very strict when it comes down to naming our programs. This is why part of the names will be generated while the other part will be chosen by the user. The application name is the part that can be chosen by users. The physical file will be named: xxxxxx -> where xxxxxx is the application name. In our example, the file will be named ORCH01PF. And it goes the same with the rest of the naming, for example the "add new department program" will be called ORCH01AD.

The "Application title" is used to depict the title of the whole application in comparison with the "module text". Our application title is "Organization chart", but underneath the title, on every screen it would appear the module text - in our case: Add department or Change department, etc.

* The second part is the most important part and here one should describe the fields of the file:



All the three fields are described here. The order of the fields matters for the keys. Besides variable name, type, length and decimals which are self-explenatory, the next fields represent:

  • Column heading - used in the file description
  • Display name - as it will be displayed on the screen
  • Subfile name - as it will be displayed in the subfile - only if it appears in the subfile. Also the length of the description text should be small.
  • Key - is this field a part of the unique key?
  • Appear subfile - does this field appear in the initial subfile?
  • Blank/Zero capable - is this field blank capable? Not applicable for key fields.
In our example we have put the ID as a unique key and only the name of the department in the subfile (the address would occupy a large portion of screen). Also, the address is blank capable.

* The third part is reserved for validation against external files and would not be used in this first example.

Next, you should press the "Generate the ZIP file" and download the generated sources.



These can be uploaded to the iSeries via FTP or any other methods. Also the application allows you to generate a batch file (.bat) where you can create your own script for uploading the sources to the machine. The content of the batch file can be modified in the User preferences area.

After you manage to upload the sources, you must compile (in order) the DDS sources (display file and physical file) and then programs - RPG and CL (only if you need it for some extra processing).


and


After you compile all the sources, you must call the "Work with departments program" - ORCHWK01. This general program is the main window, from where you can add new departments, change/delete the existing ones or perfom a search. The first screen is rather empty, because in our file there are no records.



In order to populate our file, we will add one department by pressing F6 - Add. This brings the screen where all the fields of the file are present, the key being evidenced. Validation of these fields will be performed.


After pressing ENTER in order to add the record, the view is returned to the initial screen where we have our first entry :)



You can then afterwards add another department, copy, display or change an existing one.


or


In the same style you can search for existing items (if the file contains many records). The search can be done on any column and only the respective records will be shown.

Options:

Size

Colors