# Quick Exercise

> Build a complete IS Tools application step by step. Create tables, fields, lists, relations, and a multi-section form with Repeater, Detail, and Selector.

## Configure the data model

1.  Open the [Data model editor](data_model_editor.md), the entry is found in the [navigation menu](navigation_menu.md).

2.  Create tables and fields.

    1.  Create a new table by clicking the **Create new** button in the left corner under the **Tables** tab. Name the new table _"Employee"_.

    2.  Add a new field to the table by clicking the **Create new** button under the **Fields** tab.

        Give the new fields the following specifications:

        | Name | Type | List/Parent table | Mandatory | Unique |
        | --- | --- | --- | --- | --- |
        | Avatar | File |  |  |  |
        | E-mail address | Text |  | ✓ | ✓ |
        | First name | Text |  | ✓ |  |
        | Full name | Text |  |  |  |
        | Last name | Text |  | ✓ |  |
        | Number of active projects | Number |  |  |  |
        | Phone number | Text |  | ✓ | ✓ |
        | Salary | Number |  | ✓ |  |
        | Standard work hours (week) | Number |  | ✓ |  |
        | Title | Text |  | ✓ |  |

    3.  Add a new table and name it _"Daily Status"_. Add the following fields to the new table.

        | Name | Type | List/Parent table | Mandatory | Unique |
        | --- | --- | --- | --- | --- |
        | Active projects | Number |  |  |  |
        | Average project completion | Number |  |  |  |
        | Date | Date |  |  |  |
        | Meetings | Number |  |  |  |
        | Percentage of employees at work | Number |  |  |  |
        | Working Employees | Number |  |  |  |

3.  Drop-downs, lists and list items.

    Sometimes we want the values of a field to be fixed to the values in a list. In those cases we use Drop-downs and lists.

    1.  Add a new list by first clicking the **Lists** tab. Then click the **Create new** button. Name the new list _"Departments"_

    2.  Add list items to _Departments_ by clicking the **Create new** button under the **List items** tab.

        Add the following list items to the list:

        | Name | Type |
        | --- | --- |
        | Human resources | List item |
        | Finance | List item |
        | Marketing | List item |
        | Administration | List item |
        | Project management | List item |
        | Sales | List item |

    3.  Add a new list named _"Employee status"_ and add the following list items.

        | Name | Type |
        | --- | --- |
        | Working (available) | List item |
        | Working (unavailable) | List item |
        | Sick leave | List item |
        | On administrative leave | List item |
        | Unavailable (personal) | List item |
        | On vacation | List item |
        | Off work | List item |
        | Terminated | List item |

    4.  Go to the _Employee_ table and add the following fields.

        | Name | Type | List/Parent table | Mandatory | Unique |
        | --- | --- | --- | --- | --- |
        | Department | Drop-down | Department |  |  |
        | Status | Drop-down | Employee Status |  |  |

        The values of _Department_ and _Status_ in the data records of _Employee_ will now be fixed to the _Departments_ and _Employee status_ lists.

4.  Relations

    Sometimes you want a field to represent data record in another table, in those cases, we use relations.

    1.  Add a new table named _"Project"_ with the following fields.

        | Name | Type | List/Parent table | Mandatory | Unique |
        | --- | --- | --- | --- | --- |
        | Project name | Text |  | ✓ | ✓ |
        | Actual required human-hours | Number |  |  |  |
        | Completion status | Number |  |  |  |
        | Project index | Number |  |  |  |
        | Projected human-hours | Number |  |  |  |
        | Project overview | Note |  |  |  |
        | Main department | Drop-down | Department |  |  |
        | Active | Checkbox |  |  |  |
        | Manually scheduled | Checkbox |  |  |  |
        | Actual completion time | Date time |  |  |  |
        | Actual start time | Date time |  |  |  |
        | Projected completion time | Date time |  | ✓ |  |
        | Projected start time | Date time |  | ✓ |  |

    2.  Add the two following fields to _Project_.

        | Name | Type | List/Parent table | Mandatory | Unique |
        | --- | --- | --- | --- | --- |
        | Project manager | Relation | Employee |  |  |
        | Parent | Relation | Project |  |  |

        This will make _Project manager_ store data records from the _Employee_ table and _Parent_ will store previous data records from _Projects_.

    3.  Go to the _Employee_ table and add the following field.

        | Name | Type | List/Parent table | Mandatory | Unique |
        | --- | --- | --- | --- | --- |
        | Most recent project | Relation | Project |  |  |

## Configure the forms

1.  Open [**Form designer**](form_designer.md) in the [**Navigation menu**](navigation_menu.md).

2.  Click the big gray area under the top menu to get the **Properties** menu. Set the form caption to _"Employee Overview"_. This will be the name that the form is saved as.

    > **Tip:**
    > 
    > Always start the design of a form by giving the form its caption.

3.  To display record information with a built-in selector, add a **Multi detail** section by dragging down from the **Multi detail** button.

    1.  Set the **Datasource** to _Daily Status_ in the **Properties** section.

    2.  In the **Fields** section drag out _Active projects_ and place it in the **Multi detail** section. This will add a **Number** field with _Active projects_ as datasource and a [**Label**](form_designer_components.md#label) field which is the label for the Number field that has been added. Do the same thing with _Working Employees_ and _Date_.

    3.  Add a [**Meter**](form_designer_components.md#meter) component to the **Multi detail** section by clicking the **Meter** button and then placing it inside the section. Choose _Average project completion_ as **Datasource**. Add a **Label**, place it beside the **Meter**.

        > **Tip:**
        > 
        > It’s a good practice to save the form periodically while configuring.

        Before proceeding further, add a **Meter** with _Percentage of employees at work_ as **Datasource** and a **Label** for it.

4.  The next task is to display info about an employee.

    1.  We begin by adding a Selector component. Set the **Datasource** to _Employee_.

    2.  To display information from the record chosen by the **Selector**, add a **Detail** component. Set the **Datasource** to _Employee_ and **Limited by** the **Selector**.

    3.  Add the following fields from the **Fields** section:

        -   First name

        -   Last name

        -   Department

        -   Title

        -   E-mail address

        -   Phone number

        -   Standard work hours (week)

        -   Salary

        -   Latest clock-in

        -   Latest clock-out

    4.  Add another **Detail** component for displaying projects. Set the **Datasource** to _Employee_ and also make it limited by the previously added **Detail** component.

        1.  From the **Fields** tab, add _Project name_.

            > **Note:**
            > 
            > Because of _Project name_ being a field in _Project_ and not in _Employee_, we must click _Most recent project_ to display _Project name_ in the **Fields** tab.

        2.  Add a **Multi-value** component to the **Detail** component. Give it the following properties.

            | Relation field | Employee \[Link: Project & Employee\] |
            | --- | --- |
            | Datasource | Project |

5.  To get a good overview of all employees, add a **Repeater** component and set the **Datasource** to _Employee_.

    1.  Add the following components to the **Repeater**.

        -   Full name

        -   Status

        -   Department

        -   Title

        -   Most recent project

6.  We now have a working form that can be found under **General** in the [**Navigation menu**](navigation_menu.md). There are several additional functions that can be applied to make the application more intuitive. We will add some of those features later.

## Enter data in form

1.  Click the form we just created in the [**navigation menu**](navigation_menu.md).

2.  Go to the Detail section with the text fields. To create a new employee, click the **+** icon in the top-right corner of the Detail section to create a new record. Fill the following fields. Use your imagination.

    -   First name

    -   Last name

    -   Department

    -   Title

    -   Standard work hours (week)

    -   Salary

    -   E-mail address

    -   Phone number

    When all the fields are entered, save the form. The new Employee is now displayed in the **Repeater** section.

3.  Create more employees.

## Create/Edit Roles

1.  Click the [**Role administration**](role_administration.md) entry in the [**navigation menu**](navigation_menu.md).

2.  Override the chosen role in the **Edit/New role** tab. Give the following specifications.

    | Role | FINANCE |
    | --- | --- |
    | Description | Responsible for payments |

    > **Tip:**
    > 
    > Choose the _USER_ role before overriding to ensure we don’t make any mistakes in the saving phase that deletes a more valuable role.

3.  Save the new role by clicking **Save as new role** button.

4.  Editing roles follows the same principle but instead of clicking the **Save as new role** button, click the **Save** button.

## Set access Form rights

1.  Click the [**Form rights**](form_rights.md) entry in the [**navigation menu**](navigation_menu.md).

2.  Tick the **View** box for the _FINANCE_ role in the **Employee Overview** form.

3.  Click the **Save** button to set the new access rights.

## Create users and assign roles

1.  Click the [**User administration**](user_administration.md) entry in the [**navigation menu**](navigation_menu.md). We can now see a list of all the users in our application.

2.  To add a new user, click the **Create new user** button. Give the new user the following data:

    | Username | First name | Surname | E-mail address | Phone number |
    | --- | --- | --- | --- | --- |
    | [BOB@TEST.COM](mailto:BOB@TEST.COM) | Bob | Bobson | [bob@test.com](mailto:bob@test.com) | +46700000000 |

3.  When one or more users are marked in the table, the **Assign roles** and **More actions…​** button appears in the top menu. Make sure _BOB@TEST.COM_ is the only marked user and assign the _FINANCE_ role.

4.  In a regular case, we would send the account details to _Bob_ with the **Send account details by mail** feature that is found when you click the **More actions…​** button. We will ignore that step because _Bob_ is a fictional character.

## Configure reports

For extracting data we use [**Reports**](reports.md). Now we will walk through how to create a report.

1.  Click the [**Report manager**](report_manager.md) entry in the [**navigation menu**](navigation_menu.md).

2.  Choose the tables to include in the report. We will choose _Employee_ as the main table. Click **Next**.

3.  Choose the fields to include. We will choose _Full name_, _Department_, _Standard work hours (week)_ and _Salary_. Click **Next**.

4.  Choose which fields and in what order of fields that the report will be sorted. We will choose _Full name_ as first and _Salary_ as second. Click **Next**.

5.  We only want the data from those employees that has a salary larger than _10000_. Therefor we will now add a filter. Do it by selecting _Salary_ and setting the filter to `Employee / Salary > 10000`. Add the filter and click **Next**.

6.  On this page it’s possible to change the headings in the report. Click **Next**.

7.  We can now choose if the report should be private or open to certain roles. In our case we want to share the report with the _FINANCE_ role. Therefore choose that the report is a **Role based report** and we put _FINANCE_ in the **Current roles** section. Click **Next**.

8.  Here we can choose to make the report scheduled. This will generate the report according to the schedule that is set. We will ignore this step by making the report **Not scheduled**. Click **Next**.

9.  Choose the **Report name**, **Description** and **Sheet name**. Click **Finish**.

## Generate report

Now that a report is configured, it’s time to extract the data.

1.  Click the [**Report manager**](report_manager.md) entry in the [**navigation menu**](navigation_menu.md).

2.  Select the newly made report and click the **Run** button.

3.  Choose _Excel_ as the format and then click **Run report**.

4.  Go to the [**Report queue**](report_queue.md) by clicking the **Report- and import queue** entry in the [**navigation menu**](navigation_menu.md).

5.  Now we can download the report by just clicking the **Excel** icon.
