In QGIS 3.18. This question is related to this one which has not been answered; my hope is that a broader question will help solve my problem.

I have a shapefile layer for which I want some attributes to be represented as a series of checkboxes. The method I am aware of for accomplishing this is by using the Value Relation widget in Layer Properties-->Attributes Form.

My understanding of the correct method is to create 1 table with several columns, each of which contains the possible values for 1 field in my shapefile, to be represented as checkboxes with the Value Relation widget.

My question is this: what is the best file format to use as the source table, when using a local shapefile (and not an external database)?

All of the table formats I have attempted have been problematic:

  1. Delimited value files (csv, tab-delimited text) work perfectly well at first, but the correct behavior does not persist; the table invariably gets scrambled after a few times opening the project, and needs to be reloaded-- not an option for my users. See my question linked above for details; one commenter suggests that I should use a more stable format than csv.

  2. Excel files (xlsx) do not work because QGIS does not consistently recognize the column headers. In this thread, one commenter suggests that Excel files should be exported to csv.

  3. Dbf files are not really an option for my users since the table of values needs to be editable. New versions of Excel are no longer compatible with dbf, and from what I can tell, dbf doesn't work well as a standalone file to be edited in QGIS.

  4. Geopackage probably works but my company doesn't want to use it for a number of reasons (I've tried to convince them otherwise, but don't want to keep fighting them on it.)

Users of QGIS forms with checkboxes: what's worked for you?

  • Update: for the time being, I'm getting by with dbf files that I got from saving Excel files to csv, then exporting to shapefile in QGIS (which saves a dbf). My edits seem to be getting saved without a problem so far. I will update if this changes.
    – pete
    Commented Dec 7, 2021 at 12:19


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.