The FETCH should be read as: fetch all user entities and rename the name property to "Name".
FETCH user (key, name AS "Name")
Will yield the result, notice the column names:
| key | Name |
|---|---|
| 1 | user1 |
| 2 | user2 |
The FILTER directive at line 2 should read as: filter user entities by their name property and match only those that end in 1.
FETCH user (key, name)
FILTER AND (name LIKE "%1")
Will yield the results:
| key | Name |
|---|---|
| 1 | user1 |
FETCH user (key, name AS "Name") {
user_type TO id_user (type AS "Type")
}
Will yield the result, notice the column names:
| key | Name | Type |
|---|---|---|
| 1 | user1 | Admin |
| 2 | user2 | User |
FETCH user (key, name) {
user_type TO id_user (type)
FILTER AND (type == "Admin")
}
Will yield the results:
| key | name | type |
|---|---|---|
| 1 | user1 | Admin |
Overview
FETCH is a custom query language that allows retrieving, filtering and aggregating data from one or more entities. It is used throughout the entire system to define search views, catalogs, charts, reports and much more.
Filtering
Filtering helps retrieve only the required data. Let's say we have an entity car with a property year_of_manufacturing and we want all the cars newer than 2015.