I've got a vector layer with a QGIS Form and the column "test"
in the attribute table. I have values for the columns e.g: abc
, abc
, abcd
.
I defined a form for this Layer. The type for the column "test"
is Value Relation
and I checked Use Completer
.
When I create a new feature for this Layer in the form I get a dropdown when I type the first letter as desired. But in the dropdown, I have three options to select: abc
, abc
, abcd
. So abc
is duplicated.
I would like to remove the duplicates from this list. I just would like to see: abc
, abcd
Is there a possibility to do this?
QGIS-Version: 3.22.9
How-To-Reproduce:
- Open an empty Project
- Create an empty shape-layer with one text field
- In Form use
Value Relation
and checkUse Completer
- Add a new feature
3 Answers 3
You can use the Value Map
form widget to have a list of unique items, even from a field with duplicate values.
Value Map: A combo box with predefined items. The value is stored in the attribute, the description is shown in the combo box. You can define values manually or load them from a layer or a CSV file.
-
I cant add new Values with this in the atribute form or can i?fsg– fsg2023年03月06日 07:47:17 +00:00Commented Mar 6, 2023 at 7:47
-
For me, you can't.J. Monticolo– J. Monticolo2023年03月17日 15:24:14 +00:00Commented Mar 17, 2023 at 15:24
-
Then, this isnt an option for me!fsg– fsg2023年03月22日 08:06:04 +00:00Commented Mar 22, 2023 at 8:06
The answer by @J.Monticolo should be correct. Additionally, your data may be the source of the problem if there are blank spaces hidden in the values. For example, your values may include 'abc'
, ' abc'
, 'abc '
, or ' abc '
.
These often arise as data entry errors and are difficult to visually spot. They will appear separately in a value map, but because the blank spaces are difficult to notice they will appear to be duplicated.
"fid" = array_first(array_agg("fid", group_by:="Direction"))
-
This changes my values from e.g. "abc" to "(abc)" and completer doesnt work...fsg– fsg2023年03月06日 15:02:58 +00:00Commented Mar 6, 2023 at 15:02
Explore related questions
See similar questions with these tags.
test
column.