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

**URL:** <https://community.fibery.io/t/creating-a-button-with-a-formula-to-fill-a-list-with-users-linked-to-an-entity/4102>\
**Category:** Get Help\
**Created:** [March 8, 2023, 2:40pm UTC](https://community.fibery.io/t/creating-a-button-with-a-formula-to-fill-a-list-with-users-linked-to-an-entity/4102 "2023-03-08T14:40:21Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![gomocoop](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/gomocoop/32/6349_2.png) [@gomocoop](https://community.fibery.io/u/gomocoop)\
**Post date:** [March 8, 2023, 2:40pm UTC](https://community.fibery.io/t/creating-a-button-with-a-formula-to-fill-a-list-with-users-linked-to-an-entity/4102/1 "2023-03-08T14:40:21Z")

</div>

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! =)

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [March 8, 2023, 2:59pm UTC](https://community.fibery.io/t/creating-a-button-with-a-formula-to-fill-a-list-with-users-linked-to-an-entity/4102/2 "2023-03-08T14:59:57Z")

</div>

> [@gomocoop](#):
>
> 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

The guide to formulas starts [here](https://the.fibery.io/@public/User_Guide/Guide/Formulas-39)

> [@gomocoop](#):
>
> I’ve noticed there’s always something about brackets`[]` and dots `.`

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.

---

<div class="post-metadata">

**Author:** ![gomocoop](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/gomocoop/32/6349_2.png) [@gomocoop](https://community.fibery.io/u/gomocoop)\
**Post date:** [March 8, 2023, 9:34pm UTC](https://community.fibery.io/t/creating-a-button-with-a-formula-to-fill-a-list-with-users-linked-to-an-entity/4102/3 "2023-03-08T21:34:40Z")

</div>

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.

 ![Captura de Tela 2023-03-08 às 17.52.28](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/4/45ab4dcd45109524eab81c4f0b10555596772054.png)

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)…

 ![Captura de Tela 2023-03-08 às 18.30.17](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/5/5d196130f6834b3efe41bccb8371d63b4e7512ef.png)

Does it helps? =/

Thank you very much

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [March 8, 2023, 10:48pm UTC](https://community.fibery.io/t/creating-a-button-with-a-formula-to-fill-a-list-with-users-linked-to-an-entity/4102/4 "2023-03-08T22:48:54Z")

</div>

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

> [@gomocoop](#):
>
> `[Step 1 Meeting].[Circle].[Participants]`

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]` 🤞, then type a dot, and start typing `Cír...` and it will offer to autocomplete as `[Step 1 Reunião].Círculo` 🤞, then type a dot again and start typing `Par...` and it will offer `[Step 1 Reunião].Círculo.Participantes` 🤞

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

---

<div class="post-metadata">

**Author:** ![gomocoop](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/gomocoop/32/6349_2.png) [@gomocoop](https://community.fibery.io/u/gomocoop)\
**Post date:** [March 28, 2023, 1:54pm UTC](https://community.fibery.io/t/creating-a-button-with-a-formula-to-fill-a-list-with-users-linked-to-an-entity/4102/5 "2023-03-28T13:54:39Z")

</div>

Hi @Chr1sG, getting back to this:

> [@Chr1sG](#):
>
> If not, try recording a video/screenshots and uploading here so we can see what you actually get.

 ![Captura de Tela 2023-03-28 às 10.53.21](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/0/0ac2609afaef6be8c5d19cbda0d910e12c0300d6.png)

This is what happens when I write the code.

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [March 28, 2023, 2:59pm UTC](https://community.fibery.io/t/creating-a-button-with-a-formula-to-fill-a-list-with-users-linked-to-an-entity/4102/6 "2023-03-28T14:59:02Z")

</div>

Are you sure this is true?

> [@Chr1sG](#):
>
> Circle 1:n Meetings

---

<div class="post-metadata">

**Author:** ![gomocoop](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/gomocoop/32/6349_2.png) [@gomocoop](https://community.fibery.io/u/gomocoop)\
**Post date:** [March 29, 2023, 8:41pm UTC](https://community.fibery.io/t/creating-a-button-with-a-formula-to-fill-a-list-with-users-linked-to-an-entity/4102/7 "2023-03-29T20:41:06Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [March 29, 2023, 8:58pm UTC](https://community.fibery.io/t/creating-a-button-with-a-formula-to-fill-a-list-with-users-linked-to-an-entity/4102/8 "2023-03-29T20:58:17Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![gomocoop](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/gomocoop/32/6349_2.png) [@gomocoop](https://community.fibery.io/u/gomocoop)\
**Post date:** [March 29, 2023, 9:16pm UTC](https://community.fibery.io/t/creating-a-button-with-a-formula-to-fill-a-list-with-users-linked-to-an-entity/4102/9 "2023-03-29T21:16:47Z")

</div>

YES! It worked, @Chr1sG!

Thank you SOOOO much for attention and patience. =)

---

<div class="post-metadata">

**Author:** ![gomocoop](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/gomocoop/32/6349_2.png) [@gomocoop](https://community.fibery.io/u/gomocoop)\
**Post date:** [May 8, 2023, 11:18pm UTC](https://community.fibery.io/t/creating-a-button-with-a-formula-to-fill-a-list-with-users-linked-to-an-entity/4102/10 "2023-05-08T23:18:49Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [May 9, 2023, 6:59am UTC](https://community.fibery.io/t/creating-a-button-with-a-formula-to-fill-a-list-with-users-linked-to-an-entity/4102/11 "2023-05-09T06:59:59Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![gomocoop](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/gomocoop/32/6349_2.png) [@gomocoop](https://community.fibery.io/u/gomocoop)\
**Post date:** [May 9, 2023, 9:00pm UTC](https://community.fibery.io/t/creating-a-button-with-a-formula-to-fill-a-list-with-users-linked-to-an-entity/4102/12 "2023-05-09T21:00:11Z")

</div>

> [@Chr1sG](#):
>
> [Step 1 Meeting].[Circles Participants].filter(Status.Name = “Active”)

YES! Exactly. Thank you. =)
