# Calculating length in a function in a runtime object

**URL:** <https://community.appfarm.io/t/calculating-length-in-a-function-in-a-runtime-object/2120>\
**Category:** Bug reports\
**Tags:** app-data, runtime\
**Created:** [October 31, 2025, 9:15am UTC](https://community.appfarm.io/t/calculating-length-in-a-function-in-a-runtime-object/2120 "2025-10-31T09:15:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Preben](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/preben/32/545_2.png) [@Preben](https://community.appfarm.io/u/Preben)\
**Post date:** [October 31, 2025, 9:15am UTC](https://community.appfarm.io/t/calculating-length-in-a-function-in-a-runtime-object/2120/1 "2025-10-31T09:15:09Z")

</div>

Hi, i wanted to have the field length of phone to be able to create some validations and UI effects.

I put the phone length field as a runtime property on the customer runtime object. But when I type a phone number in the UI it seems like the function is lagging behind and are not able to calculcate on the latest version of the phone field state.

On the pictures below you see that the function returns 4 while the length is 8

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/appfarm/original/2X/e/ed667ddc8769f4cb606fc978b928ecd285cad403.png)

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/appfarm/original/2X/1/1f13e37346254c08b88f68ffa16c0d37aa5dfdd6.png)

---

<div class="post-metadata">

**Author:** ![ErikAKSkallevold](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/erikakskallevold/32/1378_2.png) [@ErikAKSkallevold](https://community.appfarm.io/u/ErikAKSkallevold)\
**Post date:** [October 31, 2025, 9:21am UTC](https://community.appfarm.io/t/calculating-length-in-a-function-in-a-runtime-object/2120/2 "2025-10-31T09:21:31Z")

</div>

Hi,

Have you databound the self property for “phone” in the function for calculating the length of the phone number?

> **[Update object | Appfarm Documentation](https://docs.appfarm.io/library/action-nodes/update-object#self-properties-and-dependencies)**

// Erik

---

<div class="post-metadata">

**Author:** ![Preben](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/preben/32/545_2.png) [@Preben](https://community.appfarm.io/u/Preben)\
**Post date:** [October 31, 2025, 9:34am UTC](https://community.appfarm.io/t/calculating-length-in-a-function-in-a-runtime-object/2120/3 "2025-10-31T09:34:08Z")

</div>

I have changed it now, but I belive I did not pick from the self list, but selected the same field in the runtime object list

---

<div class="post-metadata">

**Author:** ![ErikAKSkallevold](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/erikakskallevold/32/1378_2.png) [@ErikAKSkallevold](https://community.appfarm.io/u/ErikAKSkallevold)\
**Post date:** [October 31, 2025, 1:11pm UTC](https://community.appfarm.io/t/calculating-length-in-a-function-in-a-runtime-object/2120/4 "2025-10-31T13:11:38Z")

</div>

If that is the case, then the behavior is expected. Those props have a reference to the old value, while self values have a reference to the new value.

// Erik

---

<div class="post-metadata">

**Author:** ![Preben](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/preben/32/545_2.png) [@Preben](https://community.appfarm.io/u/Preben)\
**Post date:** [October 31, 2025, 1:26pm UTC](https://community.appfarm.io/t/calculating-length-in-a-function-in-a-runtime-object/2120/5 "2025-10-31T13:26:21Z")

</div>

That’s nice to know, thanks 🙂
