> For the complete documentation index, see [llms.txt](https://docs.ilsas.uniwa.gr/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ilsas.uniwa.gr/urungi/english/urungi-user-manual/3.-layers.md).

# 3. Layers

### 3.1 Creation of a Layer

Layers allow to create views from which you can create statistics, reports and dashboards.

All the fields placed in a layer will be available, but only them.

A layer contains:

* table fields from the database
* fields associated with functions (account, year, etc.) used to calculate or extract strings
* folders that allow you to group the fields
* SQL reports from the 'Reports' module of Koha

The links between the different tables of the layer are made by the layer creator.

When creating a layer, you must immediately enter the name and description of the layer. This can be modified later.

<figure><img src="/files/GNf4NipY4Ga1ytunJSUW" alt="" width="375"><figcaption><p>Test 111</p></figcaption></figure>

The layer is then displayed according to the following screen:

<figure><img src="/files/050YlxffpdH8sddcsUOA" alt=""><figcaption></figcaption></figure>

Click on ‘Source’ to select the data source on which the layer will be based, then on the name of the source you wish to use. The list of tables in the database will be retrieved and displayed:

<figure><img src="/files/meXh10YLilPCmYPmzmgy" alt="" width="375"><figcaption></figcaption></figure>

Click ‘Add’ to put the tables you want in the layer space.

Attention: the tables are systematically placed at the top left, one on top of the other. You must arrange them as you wish:

<figure><img src="/files/OcRqEgSRtp31KD6lzK6L" alt="" width="375"><figcaption></figcaption></figure>

The next step is to link the tables together.

In our example, the ‘currency’ field of the aqbooksellers table is a SQL constraint of ‘currency.currency’.

Let's drag and drop from the green half circle (on the right) of the aqbooksellers table to the green half disk (on the left) of the currency table:

<figure><img src="/files/ZSelUDbd935aceG3fx8z" alt="" width="375"><figcaption></figcaption></figure>

You can specify the nature of the join by clicking on the link line.

We can now start putting fields in our layer. This is done by clicking on the white plus green (+) to the left of the field concerned.

Let's activate the name of the supplier:

<div align="left"><figure><img src="/files/XC6jdEr9kxmQhDI8ywv7" alt="" width="375"><figcaption></figcaption></figure></div>

<div align="right"><figure><img src="/files/TI7J04K6WHT59Mr09kCf" alt="" width="375"><figcaption></figcaption></figure></div>

The ‘Label’ will be the title presented to the user.

The ‘Type’ allows Urungi to know which functionalities are available (a numeric type will allow to make mathematical calculations, a date type to enter a calendar, etc.).

The default aggregation allows you to select a function which will be associated with the default field:

* raw: no aggregation
* count: count the number of occurrences of the value
* sum: add the values of the field
* avg: the average of the field values
* max: the largest value of the field
* min: the smallest value of the field.

As the layer is created, the different fields appear on the right (‘Layer elements’ tab).

<figure><img src="/files/OJ9ufOOYjM1ZXUFa2Y41" alt="" width="375"><figcaption></figcaption></figure>

**Warning:** it is important to sort the fields in the folders as you add them because then you won't know which table a field belongs to; there are fields in different tables that have the same name.

### 3.2 Sort the elements of the layer

Urungi allows the creation of folders within a layer, allowing the organization of different elements into logical blocks. The user will be able to find the information more easily.

The creation of a folder is done simply by clicking on the ‘New Folder’ button:

<figure><img src="/files/q1YnOC2Ahl9Gtf1GqBe5" alt="" width="343"><figcaption></figcaption></figure>

The element, called by default ‘my folder’ is automatically created at the bottom of the layer elements. You can change its name and click on the small diskette to validate the change:

<figure><img src="/files/9rQCQauGg5io7cqwMrvz" alt="" width="375"><figcaption></figcaption></figure>

You can then move the folder with the mouse to the level you want.

To integrate items into the folder, simply drag and drop them.

#### 3.2.1 Calculated elements

Urungi allows you to define calculated elements. To do so, click on ‘New element’ and enter the formula to be used for this calculated element.

<figure><img src="/files/e5acGc6Vx97Y0fVhLsOv" alt="" width="375"><figcaption></figcaption></figure>

In the ‘Expression’ tab, select a table in the database and then a field in this table. An alias beginning with # will be displayed at the bottom.

Example: alias ‘#pja7’ following the selection of the ‘date\_renewed’ field of the ‘borrowers’ table

<figure><img src="/files/DUdwuz8CYp9pLrWb3XMz" alt="" width="375"><figcaption></figcaption></figure>

Then you can add a function like :

* ‘YEAR’ to extract only the year if the selected field is a date
* ‘SUBSTR’ to extract characters from a string if the selected field is text
* etc.

Example : retrieve the year of the field ‘date\_renewed’

<figure><img src="/files/6KltpdUY8kdQxvKAiUrr" alt="" width="375"><figcaption></figcaption></figure>

In the 'General' tab, we indicate the title of the new element and the type of the selection field:

* string: text type
* number: numeric type
* date: date type

<figure><img src="/files/qX0SKYv2gugJTpyCKgGu" alt="" width="375"><figcaption></figcaption></figure>

The ‘Format’ tab concerns date type fields: it allows to choose the display format of the ‘Number’ and ‘Date’ fields.

<figure><img src="/files/R8Z37OAfeiQlBcRR7EWr" alt="" width="375"><figcaption></figcaption></figure>

After saving the new element, the calculated fields can be recognized by the small tool on the right ![](/files/z4mT8qhauiWcNpwmOz93)

<figure><img src="/files/j0d0idECrnugidx1Zjhf" alt="" width="258"><figcaption></figcaption></figure>

#### 3.2.2 Duplicate a layer

**Layers installed by BibLibre are associated with Urungi updates. Therefore, if you modify an initial layer you risk losing your modifications on this layer when updates are launched.**

**This is why it is advisable to create your own layers by cloning those created by BibLibre and use them for your future reports.**

You can duplicate existing layers by using the ‘Export’ and ‘Import’ functions.

<figure><img src="/files/ByV1SVArQblmJeg0Wmwz" alt="" width="375"><figcaption></figcaption></figure>

**The export will create a JSON file that you will have to modify with a text editor like ‘Notepad’. You will have to change the title of the claque and its identifier.**

**The identifier is a sequence of numbers and hexadecimal letters. You will have to replace two letters and two numbers for example to create a new identifier.**

**Be careful, this sequence is hexadecimal, you must only use the letters A, B, C, D, E, F.**

**Example:** export the '(english) Acquisitions' layer and rename the json file, named 'export' by default.

<figure><img src="/files/kXToLbaez8cSJNINz35h" alt="" width="375"><figcaption></figcaption></figure>

From the text editor, search for the name of the exported file (Ctrl+F => '(english) Acquisitions') then do the following:

* in front of the field 'name' put the name of the new file (example 'My acquisitions')zassae5wd34e

<figure><img src="/files/KQrwWyTkYpW2WEGDKKi2" alt=""><figcaption></figcaption></figure>

* in the field '\_id' replace two numbers and two letters to assign a new id

<figure><img src="/files/F3LV14WA1ly20WXcEEmG" alt=""><figcaption></figcaption></figure>

Finally, it remains to import the json file corresponding to the new layer.

<figure><img src="/files/I8zztSriB5So1f0CJTPM" alt="" width="563"><figcaption></figcaption></figure>

#### 3.2.3 Conclusion

The finished layer should look something like this:

<figure><img src="/files/E6isAJdyRvXTjdMzbzYT" alt=""><figcaption></figcaption></figure>

Some additional tips:

* the small (+) on the right of each table allows to activate in one click all the fields of the table in the layer.
* the small (-) on the right of each table allows you to collapse the table and display only the fields that are linked to another table. This is purely cosmetic and has no effect on the layer itself.
* if you need to retrieve very particular data, systematically pre-calculated for example, or with a specific constraint, you can add, in addition to the database tables, one or more SQL queries which will be transformed into a ‘pseudo-table’ in your layer.

It will be frequent to add SQL reports in your layers in order to be able to retrieve the labels of your authorized Koha values.

**Example:** the query below allows to retrieve the codes and labels of the VA named 'CODE\_VA':

`SELECT authorised_value, lib FROM authorised_values WHERE category='CODE_VA'`


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ilsas.uniwa.gr/urungi/english/urungi-user-manual/3.-layers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
