[GIS] Creating multiple select dropdown list in QGIS

actionsdropdownlistqfieldqgisqgis-2

Is it possible to create a multiple select dropdown list/select widget in QGIS which links to a separate txt file?

I want to collect species lists for different locations in QField but do not want to have to enter hundreds of species names manually.

I am using QGIS 2.18

Best Answer

First I recommend to use QGIS 3.4.2, because QGIS 2.18.26 did not provide the desired results.

If your species data are saved in a CSV file, load the data into the QGIS as a table from Add vector layer NOT from Add delimited text layer along with the vector layer that you want to populate its field with the species information as follows:

  • Use Add vector layer to load both the vector file and the CSV file

enter image description here

  • Start Editing of the vector file -> Add a new field in the attribute table of type Text to populate it with information from the CSV file'

enter image description here

  • Go to the Layer properties of the vector layer -> Fields, and change the Edit widget from Text Edit to Value Relation

enter image description here

  • Under Select Layer, Key Column, Value Column, select the CSv file that contains the species information, use ID column as Key Column, and Species Name as Value Column as shown below, and click OK.

  • Now Go to to the attribute Table of the vector layer -> Species Column -> You will see a drop down list coming from the CSV file in which you can choose the species names.

enter image description here

Here is the output:

enter image description here

Related Question