# 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 th **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 |
        | --- | --- | --- | --- | --- |
        | lseActive 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 it’s 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.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.md#meter) to the **Multi detail** section by clicking the **Meter** button and then placing the **Meter** inside of the **Multi detail** section. Choose _Avarage project completion_ as datasource. Add a **Label**, place it beside the **Meter** and make it the label for for the **Meter**.

        > **Tip:**
        > 
        > Save the form before adding the **Label**. It will then be easier to find the field which the **Label** is intended to be the label for.

        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**. 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 of 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’s 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

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

1.  Go to the **Detail** section with the many **Text** fields. To create a new Employee, click the plus in the right top corner of the **Detail** section to create a new Employee. 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 field is filled. press save and update the webbsite. The new Employee is now displayed in the **Repeater** section.

2.  Create a couple 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 mistake 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 off 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 occurs 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. Therefor 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.
