Update property from runtime variable using function behaves differently

When we update an object in Appfarm, we can update several properties at the same time.

We can have an object with three properties A, B and R. Where R is a runtime property.

If we do two updates simultaneously, set A = 0, set B = A. A will receive the value 0 and B will receive the old value of A.

This is how it works in most cases. However, there is one exception:

If make two updates simultaneously, set R = 0 set B = R, and the “set B = R” is updated using a function “return r”. R will receive the value 0, and B will also receive the value 0, not the old value of R.

The outcome outlined above is unique for cases where we update a variable from a runtime, using a function. If we either don’t use a function, or the variable we update from is not a runtime variable, the updated value will receive the old value of the variable it is updated from.

Is this a bug? Or is this intended?

Hi!

This is intended behaviour. You can read more about self properties and how their values are calculated here: Update object | Appfarm Documentation .

1 Like

Hi!

Thank you for the referring me to the appropriate part of the documentation. The documentation describes that self properties in the function editor uses the new value. This is correct in the case of runtime properties. It does not seem to be the case with non-runtime properties of objects. Is there a way to use the new value of non-runtime properties?

Hi again!

It should not be a difference between runtime or non-runtime properties.

In my experiments I have an object Expense runtime object and update properties A (Expense Date: Week) and B (Expense Date: Year) where both are object properties (and not runtime properties). First B as a Data Binding of A and then B as a function returning the self property A.

Could you describe your setup a bit more to help pinpoint any issues?

I did 6 experiments,

2 with data binding, 2 with function and self property, 2 with function and non-self property.

Before each experiment A and R is 1 and B is 0.

In all experiments B is updated to A or R. A or R is sat to 0.

Runtime and non runtime behaves differently when using self property. The non-runtime property uses the old value, not the new one.

This is the action that updates A→B using a function with self property.

I made a mistake in the set up. This behaves as described in the documentation.