Automatic change of a field alias based on another field value (for a single given layer)

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

Hello quentnt1!

Thank you for your message. Unfortunately, QField currently doesn’t support dynamic aliases. The alias for a field is static and can’t be changed based on the value of another field. This is likely why your expression isn’t having the desired effect in QField.

We highly value your input and have added your suggestion to our QField Idea Platform. This platform allows users like yourself to upvote ideas that they find useful.

However, if you’re interested in sponsoring this feature, please drop an email to salesqfield.com. Your sponsorship could help us prioritize and implement this functionality sooner.

Best Regards!
Zsanett


Imported from GitHub comment by @ZsanettMed on 2024-01-04T08:45:25Z