I'm building a form to collect observation data of species. I have a layer called "observation" (point) with a field called "observer", it is the name of who sees the species. Secondly, I have a table with all the employees of the company.

In my form, I use a relation value for the field "observer" with my table, so that I have a drop-down menu with all the employees. It works perfectly.

The problem is in my layer "observation", I have many other observers, and they disappeared when I used the relation value, cause they are not in the list.

How can I have a drop-down menu with my employees, for new inputs through the form, but still let me have other "old" records with different employees?

  • 1
    Is migrating all observers in the proper "observer" table an option ? I think you are mixing two kind of data in a single field, a foreign key to observers, and also some "name and surname of observers", no ?
    – etrimaille
    May 9, 2023 at 16:30
  • No, it is not possible, cause I would have really a lot of observers. I don't think I'm mixing two kind of fields. I have one field in my table called "name". And one field in the layer "observation" called "name". The relation is made between them simply like that: name<->name. So in the form of the layer observation, for "name", I use "relation value"... and I works, I have the correct dropdown list! The problem is that the old names are not in the table "observer", so they disappear in the attribute table. I don't want the old name in the dropdown list.
    – katagena
    May 9, 2023 at 16:50
  • To be honest, I can't migrate all the observers the the table. The reason is that the layer "observation" collects records from employees (so I need the dropdown list). But I also received datas from other peoples (outside the company), and I append these records to the main layer. So I would have to update the "observer" table each time I receive new datas. So if we digitalize new data in qgis (using form), only the employees, but if I use "append" for outside company data, it can be anything!
    – katagena
    May 9, 2023 at 17:04

1 Answer 1


Keep the "old" field with the old observers, then create a new field with value relation that you use for new oberservs: those you take with value relation from the table. So you have a clean dataset and don't have to mix old and new observers with the risk of altering data.

You can define a constraint in the "new" field so that if the "old" field already contains a name, it should stay empty.

To combine both old and new observer values, create a 3rd field as virtual filed that dynamically updates and that combines both fields, like:

if (length ("name_old") > 0, "name_old",  represent_value ("name_new"))

This field is what you're looking for as it combines bot manually entered values as well as the names from the value relation.

enter image description here

  • 1
    I had the same idea, by having a "temp_observer", that I use for new records with only the active employees. The field "observer" would have a default value as "temp_observer".
    – katagena
    May 10, 2023 at 10:04

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.