Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sorting features and values in the mobile app #513

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions src/field/layers/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The **Layers** button is located in the bottom navigation panel.

It provides the overview of layers and features in your <MainPlatformNameLink /> project in <MobileAppName />, as well as the option to turn the visibility of specific layers on/off or to see a layer's legend.

![Layers in Mergin Maps mobile app](../mobile-app-ui/mobile-app-layers.jpg "Layers in Mergin Maps mobile app")
![Layers in Mergin Maps mobile app](../../layer/non-spatial-data/mobile-app-non-spatial-layers.jpg "Layers in Mergin Maps mobile app")

## Layers visibility

Expand All @@ -16,8 +16,26 @@ The visibility of layers on the map can be easily turned on and off by toggling
![Mergin Maps mobile app Layers visibility](./mobile-app-layers-off.jpg "Mergin Maps mobile app Layers visibility")

## Layers legend and features
Select a layer in the **Layers** panel to browse features and [search for attributes values](../../gis/search_data/#searching-for-values-in-mergin-maps-mobile-app). Tap on the record to zoom to the feature on the map and display its form.
Select a layer in the **Layers** panel to browse features and [search for attributes values](#browsing-features). Tap on the record to zoom to the feature on the map and display its form.

Swipe right or tap **Layer info** to see the layer's legend and to toggle on/off its visibility on the map.

![Mergin Maps mobile app Layers legend and features](./mobile-app-layers.jpg "Layers legend and features")

## Browsing features
Attribute data can be browsed in the <MobileAppNameShort /> by tapping **Layers**.

In the **Layers** window, choose a layer or a table from the list to open the list of features.

![Layers overview in Mergin Maps mobile app](../mobile-app-ui/mobile-app-layers.jpg "Layers overview in Mergin Maps mobile app")

Here, you can browse the features. The search bar can be used to shortlist matching records. The search looks up for a match in all searchable attributes values and is not case sensitive.

:::tip Sorting features and searching for field values
The way how features are sorted in the <MobileAppNameShort /> can be affected by [settings in the QGIS project](../../gis/search_data/).
:::

Tap on the record to zoom to the feature on the map and display its form.

![Mergin Maps mobile app browse data](./mobile-app-search-data.jpg "Mergin Maps mobile app browse data")

Binary file added src/gis/mobile-layers.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/gis/mobile-layers.xcf
Binary file not shown.
Binary file added src/gis/mobile-sort-updated-at.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/gis/mobile-sort-updated-at.xcf
Binary file not shown.
Binary file added src/gis/mobile-sorting-by-text-lentgh.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/gis/mobile-sorting-by-text-lentgh.xcf
Binary file not shown.
Binary file added src/gis/mobile-value-relation-sorted.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/gis/mobile-value-relation-sorted.xcf
Binary file not shown.
Binary file added src/gis/qgis-attribute-table-sort-expression.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/gis/qgis-attribute-table-sort-expression.xcf
Binary file not shown.
Binary file added src/gis/qgis-attribute-table-sort.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/gis/qgis-attribute-table-sort.xcf
Binary file not shown.
Binary file added src/gis/qgis-attribute-table-sorted-by-length.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file added src/gis/qgis-order-by-value-value-relation.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/gis/qgis-order-by-value-value-relation.xcf
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
87 changes: 60 additions & 27 deletions src/gis/search_data.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,78 @@
# Searching for Values in Attribute Fields
# Sorting and Search Setup
[[toc]]

In <MobileAppName />, you can search for the content of fields in spatial layers and non-spatial tables, as well as searching values from multiple fields.
There are some settings related to sorting, searching and browsing features in <MobileAppName /> that can be done in the QGIS project, such as define the order of features and values or include/exclude layers and fields from the search.

Working with layers in the <MobileAppNameShort />, including browsing features and values, is described in [Layers in <MobileAppName />](../field/layers/).


## Sorting features and value list
The <MobileAppNameShort /> follows the sorting of features in the attribute table and of values in the value relation widget as set in the QGIS project.

### Order value list by value
The [Value relation](../layer/form-widgets/#value-relation) widget has the option *Order by value*. When checked, values in the drop-down list will be listed in alphabetical or numerical order.

![QGIS Value relation order by value](./qgis-order-by-value-value-relation.jpg "QGIS Value relation order by value")

This setting is also followed by the <MobileAppNameShort />.

On the left, you can see the default list of options in the drop-down menu. On the right, the option *Order by value* is used and observed by the <MobileAppNameShort />.
![QGIS Value relation order by value](./mobile-value-relation-sorted.jpg "QGIS Value relation order by value")


### Sorting features by field value
By default, the <MobileAppNameShort /> orders features in a layer based on their `Feature ID`. The order of features can be defined in the Attribute table in QGIS.

Simple sorting based on ascending or descending value of the attributes can be used:

1. Open your project in QGIS
2. Right-click on a survey layer and open the **Attribute table**
3. In the **Attribute table**, click on the name of a field to sort the features according to the field values.
Here, we use the `update_at` field to sort features by the last update. The feature that was updated last will be the first in the list.
![QGIS Attribute table order by value](./qgis-sorting-attribute-table-updated-at.jpg "QGIS Attribute table order by value")
4. Save and synchronise the project.

In the <MobileAppNameShort />, features in a layer can be browsed by tapping the **Layers** button and selecting the layer from the list.
![Mobile app sort features by value](./mobile-layers.jpg "Mobile app sort features by value")

Features in this layer are sorted by the same field value as was defined in the QGIS project. So, instead of the default sorting by the `Feature ID`, the features are ordered by the date and time of their last update.
![Mobile app sort features by value](./mobile-sort-updated-at.jpg "Mobile app sort features by value")

### Sorting features by expression
Similarly, an expression can be used to sort features in the Attribute table and subsequently in the <MobileAppNameShort />.

1. Open your project in QGIS
2. Right-click on a survey layer and open the **Attribute table**
3. Right-click on a field name that you want to use for sorting features and use the **Sort...** option
![Mobile app sort features by value](./qgis-attribute-table-sort.jpg "Mobile app sort features by value")
4. Enter the expression you want to use to sort this field.
Here, we use `length( "notes" )` to sort features based on the length of the text in the `notes` field.
![QGIS sorting features by text length](./qgis-attribute-table-sort-expression.jpg "QGIS sorting features by text length")
![QGIS features sorted by text length](./qgis-attribute-table-sorted-by-length.jpg "QGIS features sorted by text length")
5. Save and synchronise the project.

When browsing features in the <MobileAppNameShort />, they will be sorted by the text length.
![Mobile app sort features by value](./mobile-sorting-by-text-lentgh.jpg "Mobile app sort features by value")


## Setting identifiable layers in QGIS project
To be able to browse the attributes of a layer, it needs to be set as *Identifiable* in your <QGISHelp ver="3.22" link="user_manual/introduction/qgis_configuration.html?highlight=properties#data-sources-properties" text="QGIS project" />.
To be able to browse the attributes of a layer, it needs be *Identifiable* in your <QGISHelp ver="latest" link="user_manual/introduction/qgis_configuration.html?highlight=properties#data-sources-properties" text="QGIS project" />. Layers are *identifiable* by default.

If you define a layer as **not identifiable**, you won't be able to tap it in the <MobileAppNameShort /> or use the **Identify tool** in QGIS to see its attribute form. This may be useful for layers that are only used as background layers.

1. Open your QGIS project
2. In the Menu > Project > Properties click on **Data Sources**
3. Check and uncheck layers in the **Identifiable** column to define which layers you want to be able to browse in your project.

![QGIS identifiable data sources](./qgis_data_sources.jpg "QGIS identifiable data sources")

:::warning
If you define a layer as **not identifiable**, you won't be able to tap it in <MobileAppName /> or use the **Identify tool** in QGIS to see its attribute form.
:::

## Exclude a field from the search
By default, all attributes are searchable. You can exclude a field from the search in the **Layer properties**.
1. Navigate to the **Fields** tab
2. Check the **Not searchable** option in the **Configuration** column
![QGIS Not searchable field](./not_searchable.jpg "QGIS Not searchable field")

:::warning
If a field is marked in a field configuration as **Not searchable**, it will be omitted from the search. There will be no search results, even if you search for a specific existing value of this field.
:::

## Searching for values in Mergin Maps mobile app
Attribute data can be browsed in <MobileAppName /> by tapping **Layers**.

In the **Layers** window, choose a layer or a table from the list to open the attribute table.

![Layers overview in Mergin Maps mobile app](./mobile-app-layers.jpg "Layers overview in Mergin Maps mobile app")

Here, you can browse the features. The search bar can be used to shortlist matching records.

Tap on the record to zoom to the feature on the map and display its form.

![Mergin Maps mobile app browse data](./mobile-app-search-data.jpg "Mergin Maps mobile app browse data")

:::tip
The search looks up for a match in all searchable attributes values and is not case sensitive.
:::
1. Navigate to the **Fields** tab
2. Check the **Not searchable** option in the **Configuration** column
![QGIS Not searchable field](./not_searchable.jpg "QGIS Not searchable field")

2 changes: 1 addition & 1 deletion src/layer/non-spatial-data/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ Tap the [**Layers**](../../field/layers/) button to open the list of layers, inc

![Layers in Mergin Maps mobile app](./mobile-app-non-spatial-layers.jpg "Layers in Mergin Maps mobile app")

Tap on a layer to open its attributes table where you can browse the data and [search for values](../../gis/search_data/#searching-for-values-in-mergin-maps-mobile-app). It is also possible to [add and edit](../../field/mobile-features/#add-non-spatial-features) entries in the table.
Tap on a layer to open its attributes table where you can browse the data and [search for values](../../field/layers/#browsing-features). It is also possible to [add and edit](../../field/mobile-features/#add-non-spatial-features) entries in the table.

Loading