Creating a button with a formula to fill a list with users linked to an entity

In my company we work with a governance system called Sociocracy. So we have different circles (working groups). So I have a database called Circles. And there is also a database called Meetings. Each Meeting is related to one circle. Each User is related to one or more Circles.

I have a field (Relation to Users) called “Expected People”. The expected people for each meeting depends on who is part of the circle, and I didn’t want to do it manually every time. But it can’t be a fixed list because people on the circles vary from time to time. So I thought about create a button that would fill this list with the list of users that, by that time, are part of the circle. How do I write this in programming on Fibery?
Also, is there a basic programming tutorial for Fibery? Sometimes I feel I ask really simple questions here that could be solved by some kind of manual… I’ve noticed there’s always something about brackets[ ] and dots .. For example, if I want to refer to the circle from which the meeting I’m in belongs I would write:

[Step 1 Meeting].[Circle].

But I don’t know how to refer to the list of users from the circle from that meeting, thought something like:

[Step 1 Meeting].[Circle].[Participants].

But it didn’t work. So I’m kinda missing the logic of the language hehehe

Thank you! =)

The guide to formulas starts here

Names need to be wrapped in square brackets if they have a space in their name, otherwise not. Using autocompletion can help you get it right.
Dots are used to indicate that the next bit is a property or function.
For a single entity, it is most commonly a property that follows, e.g. Task.[Due date]
For a collection, it is most commonly a function, e.g. Tasks.Filter([Due date] < Today())
Functions have brackets after their name, but may not need anything to be put in the brackets, e.g. Tasks.Count()

In automations, the triggering entity (and the linked item in the case of ‘Entity linked to…’ or ‘Entity unlinked to…’ triggers) are referred to with [Step 1 Xxx] (or [Step 1 linked...] / [Step 1 unlinked...]

It’s worth remembering that the data types must always match, so if you are attempting to use a formula to produce/update a text value, you can’t pass a date value. The data type of a formula is fixed on first creation, and can’t be subsequently changed, even if you re-write the formula.

If you show us your relation map for the relevant databases and let us know the field names, we can probably suggest the correct formulation.

I’m not sure if I have a relation map…
Each database I’ve created is located on it’s own space…
Is that ok?
I have a space called “Atas” and my meetings database “Reunião” is there. So when I click on map, at the “Atas” space, it only shows the “Reunião” database.

The way I’m trying to make is: when I click the button it updates a field (relation to Users database) called “Pessoas Esperadas” (Expected People) with the same users from the field “Participantes”, located in the database “Círculos” (each meeting has a relation field called Círculo where there is a correspondent circle selected)…

Does it helps? =/

Thank you very much

Is it correctly understood as follows:
Circle 1:n Meetings
Circles n:n Users
Meetings n:n Users

And you want a button automation to run for any given Meeting entity that will update the Users linked to the Meeting to become all the Users linked to the Circle that the Meeting is linked to?

If so, then your guess

ought to be basically correct, assuming that you get the field names right (remembering the rules for use of square brackets).

When you’re trying to add a formula, start typing Ste... and it will offer to autocomplete as [Step 1 Reunião] :crossed_fingers:, then type a dot, and start typing Cír... and it will offer to autocomplete as [Step 1 Reunião].Círculo :crossed_fingers:, then type a dot again and start typing Par... and it will offer [Step 1 Reunião].Círculo.Participantes :crossed_fingers:

If not, try recording a video/screenshots and uploading here so we can see what you actually get.

Hi @Chr1sG, getting back to this:

This is what happens when I write the code.

Are you sure this is true?

Does that means that one circle can have many meetings but a meeting can only have one circle? If it is this, then it’s not true. Actually it work both ways: one meeting can have many circles and one circle can have many meetings.

Therein lies the problem.

The formula [Step 1 Meeting].[Circle].[Participants] only works if there is a single Circle for a given Meeting.
It is not possible in formulas to get collections from collections.
i.e. if a Meeting has multiple Circles, and each of them has multiple Participants, then you can’t get all Participants using a single formula.

To resolve this, I would suggest that you need to create a lookup field in the Meeting database that gets all the Participants from all the linked Circles.
Then you can use this field in your automation formula.

YES! It worked, @Chr1sG!

Thank you SOOOO much for attention and patience. =)

1 Like

Hey @ChrisG !

I’m back here on this topic to ask for a further filter…

I wanted to know if it’s possible to fill with participants from a circle that also meets the condition to have a status of ACTIVE.

I have users that belong to a circle but are only consultants, and I didn’t want to include them in my formula. (status is a single-select field on my user database)

How do I do it? A different lookup? A change on the formula?

If I’ve understood correctly, you probably need to create a formula that filters the items returned by the lookup field, based on the status field, e.g.
[Step 1 Meeting].[Circles Participants].filter(Status.Name = "Active")

where Circles Participants is the name of the lookup field you already have.

1 Like

YES! Exactly. Thank you. =)

1 Like