# How to implement feature update in real time with a relation

**URL:** <https://community.qfield.org/t/how-to-implement-feature-update-in-real-time-with-a-relation/335>\
**Category:** Ask the Community\
**Tags:** gh-import\
**Created:** [14 May 2025 02:05 UTC](https://community.qfield.org/t/how-to-implement-feature-update-in-real-time-with-a-relation/335 "2025-05-14T02:05:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex018/uploads/qfield/original/1X/7d3726da0ef5099a1e135505c03d2f125d527aae.png) [@system](https://community.qfield.org/u/system)\
**Post date:** [14 May 2025 02:05 UTC](https://community.qfield.org/t/how-to-implement-feature-update-in-real-time-with-a-relation/335/1 "2025-05-14T02:05:40Z")

</div>

I am looking for functionality in Qfield like the one described at  
[feature-live-update](https://qgis.org/en/site/forusers/visualchangelog310/#feature-update-depending-widgets-real-time)  
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 sum up to 100.  
I created a virtual field, added it to the form, and used the expression below:

```sql
relation_aggregate(
  'obs_child_6_obs_point_id_obs_point__point_id', 
  'sum',
  "perc"
)

```

“perc” is an attribute of the “children”.  
This works well in QGIS but not in Qfield.  
Any workaround? suggestions\>?

* * *

_Imported from [GitHub discussion](https://github.com/opengisch/qfield/discussions/5272) by @rosaguilar on 2024-05-27T15:31:52Z_

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex018/uploads/qfield/original/1X/7d3726da0ef5099a1e135505c03d2f125d527aae.png) [@system](https://community.qfield.org/u/system)\
**Post date:** [14 May 2025 02:05 UTC](https://community.qfield.org/t/how-to-implement-feature-update-in-real-time-with-a-relation/335/2 "2025-05-14T02:05:41Z")

</div>

Hello rosaguilar,

It’s best to avoid a virtual field and use an actual field instead. Could you try the expression below for real-time calculations? Also, ensure that you have the “Apply default value on update” activated:

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

If you could provide a sample of the project, it would help better.

* * *

_Imported from [GitHub comment](https://github.com/opengisch/QField/discussions/5272#discussioncomment-9577122) by @SeqLaz on 2024-05-28T07:06:28Z_

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex018/uploads/qfield/original/1X/7d3726da0ef5099a1e135505c03d2f125d527aae.png) [@system](https://community.qfield.org/u/system)\
**Post date:** [14 May 2025 02:05 UTC](https://community.qfield.org/t/how-to-implement-feature-update-in-real-time-with-a-relation/335/3 "2025-05-14T02:05:43Z")

</div>

Hi, SeqLaz  
Thanks a lot. It works with an actual field. The key is that the value does not get automatically updated after each child insertion. When another field in the parent form is edited, then the value is computed. Foe now, that is good for me. Thanks.

* * *

_Imported from [GitHub comment](https://github.com/opengisch/QField/discussions/5272#discussioncomment-9578363) by @rosaguilar on 2024-05-28T09:01:23Z_

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex018/uploads/qfield/original/1X/7d3726da0ef5099a1e135505c03d2f125d527aae.png) [@system](https://community.qfield.org/u/system)\
**Post date:** [14 May 2025 02:05 UTC](https://community.qfield.org/t/how-to-implement-feature-update-in-real-time-with-a-relation/335/4 "2025-05-14T02:05:44Z")

</div>

Hi rosaguilar and SeqLaz ,  
I have the same question, but I’m looking for the missing piece you’re asking in the end: how to make the value actually update after each child insertion? This is necessary to validate live in the field if my numbers add up.  
I’ve tried many workaround, but so far, the best I came up with is to force a field update by adding a dummy radio button… an extra step in the field, and not particularly pretty.

Any tips would be welcomed.  
Thanks!

* * *

_Imported from [GitHub comment](https://github.com/opengisch/QField/discussions/5272#discussioncomment-12860682) by @Horizen89 on 2025-04-17T00:03:15Z_

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex018/uploads/qfield/original/1X/7d3726da0ef5099a1e135505c03d2f125d527aae.png) [@system](https://community.qfield.org/u/system)\
**Post date:** [14 May 2025 02:05 UTC](https://community.qfield.org/t/how-to-implement-feature-update-in-real-time-with-a-relation/335/5 "2025-05-14T02:05:46Z")

</div>

Hi Horizen89 , actually the best practice is that, add a field with a checkbox to compute the update at the end of adding children’s features and have activated `Apply default values on Update` on the fields where you want to perform these calculations.

* * *

_Imported from [GitHub comment](https://github.com/opengisch/QField/discussions/5272#discussioncomment-12870486) by @SeqLaz on 2025-04-17T17:48:36Z_

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex018/uploads/qfield/original/1X/7d3726da0ef5099a1e135505c03d2f125d527aae.png) [@system](https://community.qfield.org/u/system)\
**Post date:** [14 May 2025 02:05 UTC](https://community.qfield.org/t/how-to-implement-feature-update-in-real-time-with-a-relation/335/6 "2025-05-14T02:05:47Z")

</div>

Hi SeqLaz ,  
This is what I meant with the radio button. It works, but it’s an extra step.  
Thanks for your input, I’ll keep this solution at this point!

* * *

_Imported from [GitHub comment](https://github.com/opengisch/QField/discussions/5272#discussioncomment-12870964) by @Horizen89 on 2025-04-17T18:45:47Z_
