[✅ Solution] Calculation field: how to access a field from another app?

Hi there,

in a calculation field it’s possible to access field variables using @. This works with fields in the current app.

Is it possible to access fields from other apps? So, for example, using an app as a collection of settings to be reused in different calculations.

Thanks, Oli

1 Like

@jakoubek

Hi Oli,

thanks for opening this topic!

You can also @-mention field variables from other apps, in case those apps either have an incoming or an outgoing relation to the app with the calculation field.

Example:

  • In case you have an app “Contacts” that has a relation field to the app “Companies”, you can access field variables of the companies app within a calculation field of the contacts app and vice versa.
  • In your example, the “Settings” app would need to have an incoming or outgoing relation to your main app via a relation field. Note that a single calculation inside a record has then access to all values of referenced records. This means, that in your example, you would need to add relations from a record of the main app to the specific settings records to access the settings inside the record of the main app (or vice versa).

Concrete Steps:

  1. Add relation field to main app, so that it references the “Settings” app
  2. @Mention the target field of the settings app inside the calculation field of the main app
  3. Reference the needed settings records within the relation field of a record of the main app

or

  1. Add relation field to settings app, so that it references the main app
  2. @Mention the target field of the settings app inside the calculation field of the main app
  3. Reference the records of the main app inside the needed settings records

I hope that this answers your question - otherwise please let us know.

Happy Holidays!

Thanks @Leo

that worked. Since I have only one settings record I let an automation update my main app record after creation and set it to that settings record.

I still wonder why I can’t access a field of the referenced (here: settings) record in a calculation field. Instead I have to choose between sum, min, max, average of the field (see screenshot).

image

I have set the relationship to “link only one record”, so a calculation on probably more linked values does not make sense here.

Does your wording in that dialog relate to the possibility of linking to more that one record?

Oli

@jakoubek

Hi Oli,

thanks for bringing this up again, and you are absolutely right that in this case the wording can be a little misleading. We decided to go for a consistent approach in both variable naming and values, to allow people to use similar formulas for calculations that refer to related values in 1) single and 2) multi relation fields.

While I agree that it is a little confusing in your setup, the benefit of only one single consistent way to refer to field values hopefully makes the usage of calculations easier, and also to reuse logic from a single to a multi relation field and vice versa.

Please let me know if you have additional questions or need help regarding the calculation field.

Happy to see you building!

Cheers
Leo

@Leo in Tape automations I can search for an item field and store it in a variable.

Now I have a similar situation with a calculation in a field. I want to calculate an individual URL, based on a “base url” and an ID stored within this item. The “base url” should be stored in a “central setup” database.

As far as I understand, I would need to do a relationship with this config item stored centrally? I just think this is quite some overhead, when I calculate links in several Tape Apps, all based on the same “Base URL”? Or - do I miss something, some other way to achieve this?

2 Likes

Unfortunately not @dirk_s, you have analyzed the functionality of the calculation field completely correctly.
The need for a relation in the calculation field is caused by the fact that all related records are always updated reactively when a related field is changed.

But we could solve your use case very smooth with an automation. We will provide you with a solution for this.