# Clear field value with a condition

**URL:** <https://community.fibery.io/t/clear-field-value-with-a-condition/6117>\
**Category:** Get Help\
**Created:** [April 22, 2024, 11:55pm UTC](https://community.fibery.io/t/clear-field-value-with-a-condition/6117 "2024-04-22T23:55:17Z")\
**Posts on this page:** 7\
**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:** [April 22, 2024, 11:55pm UTC](https://community.fibery.io/t/clear-field-value-with-a-condition/6117/1 "2024-04-22T23:55:17Z")

</div>

I’ve created a button named “Deactivate” to deactivate someone from my team when this person leaves the project. This button do some updates of some fields:

 ![Captura de Tela 2024-04-22 às 20.50.51](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/e/eec24f72d3a2a9afa2ef95d3789b550510c31696.png)

**There is this relation field called Tarefas (Tasks) that I wanted to be cleared but, with a condition. I wanted to clear only the Tarefas (Tasks) which the field Situação (Status) would not be Feita (Done) or Cancelada (Cancelled).**

How can I make a formula with a condition to clear the field value. Is it possible?

Thanks

---

<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:** [April 23, 2024, 6:29am UTC](https://community.fibery.io/t/clear-field-value-with-a-condition/6117/2 "2024-04-23T06:29:43Z")

</div>

Try this

`[Step 1 User].Tarefas.Filter([Step 1 User].Situação != "Feita" and [Step 1 User].Situação != "Cancelada")`

---

<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 2, 2024, 11:46pm UTC](https://community.fibery.io/t/clear-field-value-with-a-condition/6117/3 "2024-05-02T23:46:40Z")

</div>

In this case you are filtering the user, right? But Situação it’s a field of the Task. I wanted to filter the Task, not the user…

As in clear the value of all tasks that have a situation Feita or Cancelada connected to the user…

---

<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 3, 2024, 6:12am UTC](https://community.fibery.io/t/clear-field-value-with-a-condition/6117/4 "2024-05-03T06:12:59Z")

</div>

> [@gomocoop](#):
>
> In this case you are filtering the user, right?

Maybe I misunderstood. Is Status a field property of the Task or the User? If it’s the Task, then you will need:

`[Step 1 User].Tarefas.Filter(Situação.Name != "Feita" and Situação.Name != "Cancelada")`

That assumes you want to keep the Tasks which are neither Done nor Cancelled.

If you want to keep the Tasks which are Done or Cancelled, it would be

`[Step 1 User].Tarefas.Filter(Situação.Name = "Feita" or Situação.Name = "Cancelada")`

---

<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 4, 2024, 12:38pm UTC](https://community.fibery.io/t/clear-field-value-with-a-condition/6117/5 "2024-05-04T12:38:40Z")

</div>

Yes! That would be the case.

But I want to clear the field, that’s the action. So I would have to write it right?

Summing up: I want the automation to disconnect (clear the field) from the user all the tasks that, in that moment, don’t have a status field which are Done or Cancelled.

Something like:

CLEAR THE [Step 1 User].Tarefas IF [Step 1 User].Tarefas.Filter(Situação.Name != “Feita” and Situação.Name != “Cancelada”)…

---

<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 4, 2024, 1:23pm UTC](https://community.fibery.io/t/clear-field-value-with-a-condition/6117/6 "2024-05-04T13:23:40Z")

</div>

Think of it like you don’t need to explicitly clear the field of the things you don’t want, but rather you overwrite (=update) the field to be the things you _do_ want, based on the opposite filter (which in some cases might just give nothing).

So if you want to get rid of Tasks which are not Done and not Cancelled, that means you want to keep Tasks which are either Done or Cancelled, if there are any.

i.e. you update the field with

`[Step 1 User].Tarefas.Filter(Situação.Name = "Feita" or Situação.Name = "Cancelada")`

---

<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 4, 2024, 1:48pm UTC](https://community.fibery.io/t/clear-field-value-with-a-condition/6117/7 "2024-05-04T13:48:18Z")

</div>

Perfect!

It makes sense!

Thank you very much!
