Hello everybody.
I’m trying to build a QFIELD project that automatically (for a given layer) changes the alias of one field based on the value of another field.
Let’s say I have, for a point layer, one field called “Nom” and the other one “Element”.
If the value of the Field “Element” is “Lieux de culte”, I want the alias of the field “Nom” to be “Nom du prédicateur”.
If the value of the field “Element” is “Habitation”, I want the alias of the field “Nom” to be “Nom du propriétaire/Sinon du groupe d’habitation”.
The “Element” field widget is set as a list of possible values, while the “Name” field widget is set as a character entry.
I had to make a new table containing the correspondences between aliases for the field “Nom” and values of the field “Element”, and I found a code for what I want. It works well on QGIS attribute filling forms, but not on QFIELD…
Here’s the code I put into the expression calculator near the Alias (in the attribute form) of the “Nom” field :
attribute(get_feature('entites','Valeur',current_value('Element')),'Nom')
'entites'
is the correspondence table layer (containing 'Valeur'
and 'Nom'
fields mentionnioned in the code (another called ‘Nom’ field)).
Do you have any idea why it doesn’t work ?
Thanks again for your help !!
Imported from GitHub discussion by @quentnt1 on 2023-10-04T07:25:53Z