Custom Reporting -- Creating a Staff List Example

From IHRIS Wiki

This article describe you how to create a custom staff info report for iHRIS Manage. This is a three step process:

  • Create the custom form relationship 'staff_info'.
    Here you choose the forms that you are interested in and how they are related to each other.
  • Create a custom report 'staff_report' based on the 'staff_info' relationship
    Here you choose the fields you want for your report from the relationship you created. You can also choose which fields to limit by for all the report views created from this report.
  • Create a custom report view for the staff report.
    The various views of a report are intended for non-administrative users to view the data in the system.

Actually, this is a four step process, with the first step being to figure out which data you want and where it is stored. Let us suppose we have the following requirement from an HR Manager to:

Requirement: Create a staff list with the person's cadre and facility 


The Form and Field Map

A good starting point is to look at the forms and fields and in particular the "graphic visualization" which is a map of the forms and fields in iHRIS Manage. When we construct a form relationship, we will join forms by traversing the arrows of the form field map, both forward and backward. There are two arrows in this map:

  • black arrows: The source of an arrow, formA, is related to the target of the arrow form, formB, via a mapped field. If the arrow is not labeled, then the mapped field is also named formB. Otherwise it is the label of the arrow. Although, formA maps to a most one instance of formB, there may be many instances of formA mapping to formB. Thus, when yo are going backward on a black arrow, you will probably need to limit the joined form so that a unique form is chosen.
  • red arrows: The source of an arrow, formA, is the parent of the target of the arrow, formB. FormA may have many instances of formB as a child form, but formB can only have one parent form. Thus, when you go forward on a red arrow, you will probably need to limit the child form so that a unique child form is chosen.

Step 0: What data do you want?

This is the most important step, and requires some more advanced knowledge of how the data (forms) in the system are used. Based on the HR Manager's requirement and the form and field we see that we need to include the following forms:

  • facility: We need the name of the facility
  • job: we need to know the cadre the person is working in
  • person: although not explicitly stated as a requirement, let us assume that the HR Manager also wanted to know the name of the people on staff

However, if we look at the data map, we see that there are no arrows that directly connect the facility, job and person forms. Instead we see that we need to go from the person form, through the person_positon form to the position form. From the position form, we can join the facility and job. Here is the relevant portion of the form field map:

http://www.ihris.org/w/upload/Forms-person-position-map.gif

Step 1: Create the Form Relationship

We will create a form relationship called 'staff_info'. The form we starting traversing our map from is called the primary form. We are free to choose where we want to start the mapping from, but choosing different primary forms will produce a different data set. There are actually two relationships that we can create here based on which primary form we choose.

  • option A: Choose the person form as the primary form. Then the reports based on the relationship "staff_info" will only contain the people in the system that have a position.
  • option B: Choose the position form as the primary form. Then the reports based on the relationship "staff_info" will contain everyone in the system whether or not they have a position.


Either option can make sense and your choice depends on the requirements from the HR Manager. Since the HR Manager did not give us enough details to go by, we will have to and ask him/her for clarification.


Option A: A Person Report

Select Configure System and then Form Relationships. We create a report relationship called 'staff_info' and choose "person" as the primary form, enter a display name and description. Then click update.

Now that we have created the 'staff_info' relationship we can edit it. Now we need to join the "person_position" form to the "position" form. To do this click Joined Forms then Add a New Form. Select person_position (child)" as the form to add, and the the "short name" to be 'person_position.' You should alsoo set a display name and description for this form.

Because many people may have had the same position, and we only want the positions where there are people working at them now, we will need to limit the person_position form so that:

  • the start_date is not null
  • the end_date is null

To do so, we click on Joined Forms once again and select Person Position (person_position), which is the form that we just added. Now we can choose to Limit This Form. Since we have two limits to place on this form, we will need to first create an "AND" node:

Also, to be extra cautious, you can choose to "drop the row if the form does not exist." Next, we join the "person" form to the "person_position" form as a parent form. Now, we join the "facility" form to the "position" form by the mapped field "position." We also join the "job" form to the "position" form by the mapped field "job."

Option B: A Position Report

Select Configure System and then Form Relationships. We create a report relationship called 'staff_info' and choose "position" as the primary form, enter a display name and description. Then click update.

Now that we have created the 'staff_info' relationship we can edit it. Next we need to join the "person_position" form as a child form to the "person" form.

Since the person may have had several positions, we will want to choose the most recent one, so make sure you select to "limit" the "person_position" form so that the "start_date" field is the maximum.

Now we join to the "person_position" form the "position" form by the mapped field "position." Now, we join the "facility" form to the "position" form by the mapped field "position." We also join the "job" form to the "position" form by the mapped field "job."

Step 2: Create the Report

Now that we have the relationship 'staff_info' built, we can create a report from that relationship. Go to Configure System and then Reports and choose to create a new report, called 'staff_report' based on the 'staff_info' relationship. When we are done you will see the zebra_staff_report table in the database. Here, we can choose the limits that we will want for the report views (below) as well as all the fields that we may want to see in a report view. To do so, click on the "Reporting Forms" and then the "Fields" and you will be able to enable or disable fields from the relationship to include in the report. You will also be able to change the header text for the field and set the limits for the field.

Step 3: Create the Report View

Go to Configure System and then Report Views and choose to create a new report view based on the report "staff_report." Just select the fields you want to display and you are done.