[GIS] Creating a dropdown widget in QGIS for QField project

qfieldqgiswidget

I want to collect data on crop species affected by diseases using QField. I want to create a widget so that I can have a dropdown list of the different crop species. In theory, if I were to export this project onto QField and collect data, I would select the crop species from the drop down list. Most of the answers I've found suggest changing the widget type to relation reference and link it to a CSV, but my data is already in the attribute table. Has anyone done this before? Which widget type should I use? Or any tutorials?

Best Answer

With your layer already loaded into the QGIS TOC (the layer that contains all the possible values), you should go to properties > attributes form > Widget type and select a «Value Map type». Then, click on Load Data from Layer button and on the upcoming window, you should select the layer as well as the column where to get the possible values from.

Then, via the QField Sync plugin, you can export the project to QField, so the designed form will be also available from your mobile device. Hope this helps.