Virtual Layers / Triggers and rendering

I’m struggeling a bit with the configuration of my layers. I have set up a nice project for QField (cloud) to collect tree data. The styling of the trees (points) is dependend on a field of their children (color coding of the trees should be by the maximum priority of their “ToDo” jobs. I solved this with a virtual field in the trees layer relation_aggregate('Bäume_Maßnahmen','max',"Priorität). In QField everything works fine, but in QGIS the map rendering with ~2000trees and ~1500 ToDo’s is very slow. Is it possible to configure QGIS in the way QField works and not trigger the virtual field calculation everytime the map is moved? (I assume this is how QField does it?).
I have two more ideas:

  • Working with SQL triggers in the Geopackage (will this work in QField “live” or just after uploading it into the cloud?)
  • Using QGIS Actions (fire an update in the parent layer field whenever a child feature is changed)

Anyone tried one of those yet? Or got other ideas? :slight_smile:


Imported from GitHub discussion by @meyerlor on 2024-09-10T07:06:23Z

I have a project similar to yours: I have about 2,000 points, whose symbology depends on the field of a child table.

The solution I used was to avoid virtual fields and use relation_aggregate in the symbology rules.
In the rules, I used not only relation_aggregate, but also CASE, which help me filter out cases where relation_aggregate shouldn’t be called.

Your post is a few months old; have you found a better solution?