Skip to content

live update virtual fields with children information #5274

Open

Description

@rosaguilar

Discussed in #5272

Originally posted by rosaguilar May 27, 2024
Thanks a lot for this excellent app.
I am looking for functionality in Qfield like the one described at
feature-live-update
I have defined some relations in my Qgis project and they are working well.
I need to sum all the "children" and validate that a certain attribute sums up to 100. In other words, use the field for constraint validation.
I created a virtual field, added it to the form, and used the expression below (suggested by @SeqLaz :

aggregate( layer:='child layer', aggregate:='sum', expression:="perc", filter:="uuid_parent" = attribute(@parent,'uuid') )

The expression works well in an "actual" field in the table but not in a virtual field.
It would be nice to have this working in a virtual field because you don't have to add an unnecessary field to the database structure.

Activity

  1. changed the title [-]Feature request: feature update in real time with a relation[/-] [+]Feature request: feature update (virtual fields) in real time with a relation[/+] on May 28, 2024
  2. changed the title [-]Feature request: feature update (virtual fields) in real time with a relation[/-] [+]live update virtual fields with children information[/+] on Jun 2, 2024
  3. nirvn commented on Oct 22, 2026

    @nirvn
    Member

    @rosaguilar , this PR will do what you want: #8143 -- you will however need to use the relation_aggregate function instead of the generic aggregate function (it's a newer/better function for what you are doing :) ).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions