What
Searches for a single value in a list of items.
Use-case
Archive all tasks that are not open.
Create a new button that add a new row in the table if the task is in a set of predefined statuses and removes them from the table Formula
Tasks.Filter(Status.In([Done],[Won't Do]))
.FormulaMap(CurrentValue.WithName(task,
RunActions(
[Archived Tasks].AddRow(
Task, task.Task,
Status, task.Status,
Tags, task.Tags),
task.DeleteRows())))
Formula (explained)
Tasks.Filter(Status.In([Done],[Won't Do])) // Take all tasks that have the status "Done" or "Won't Do"
.FormulaMap(CurrentValue.WithName(task, // for each one, iterate and give the value the name "task"
RunActions( // for every task we have, do the following actions:
[Archived Tasks].AddRow( // 1. add a new row in the Archived Task table...
Task, task.Task, // ... by setting its values from task.Task
Status, task.Status, // ... task.Status
Tags, task.Tags), // ... task.Tags
task.DeleteRows()))) // 2. remove the task record on the Task table
As you can see, it can be a common shortcut for chained OR conditions, i.e.
Status=”Done” OR Status=”Won’t Do”
But it’s also a good way when you don’t know how many elements you have. For instance:
Status.In(Statuses.Filter([Open].Not()))
What
Searches for a list of values in a list of items.
It returns true if any of the values is found, therefore can be considered as a OR filtering operator
Use-case
Filtering rows with multiple columns value over a list of possible values.
Find all Tasks that are ragged with urgent or strategy
Formula
Tasks.Filter(Tags.Contains(urgent,strategy))
What
Searches for a list of values in a list of items.
It returns true if all the values is found, therefore can be considered as a AND filtering operator
Use-case
Filtering rows with multiple columns value over a list of all required values.
Find all Tasks that are tagged with product and strategy (other tags are ignored)
Formula
Tasks.Filter(Tags.ContainsAll(product,strategy))
What
Searches for a list of values in a list of items.
It is a particular case of ContainsAll(): it returns true if all the values is found and are the only values of the list; it is somehow a strengthened AND operator.
Use-case
Filtering rows with multiple columns value over a list of possible values.
Find all Tasks that are only tagged product and strategy (and no other tags)
Only Product AND Strategy
4 Formula
Tasks.Filter(Tags.ContainsOnly(product,strategy))
Note that this can be misleading for list equality: we should interpret as “the elements of the values are the only one in the list”.
However, lists can have duplicate items; so look at the different scenarios:
Tasks.Filter(Tags.ContainsOnly(List(product,strategy))) // true
Tasks.Filter(Tags = List(product,strategy))) // true
Tasks.Filter(Tags.ContainsOnly(List(product,strategy, strategy))) // true
Tasks.Filter(Tags = List(product,strategy, strategy))) // false
but...
Tasks.Filter(Tags.Unique() = List(product,strategy, strategy).Unique())) // true