Can I use Modifyrows() with an if() statement in the value to be modified? Can't get it to work

I’m looking to create a single button that I can press that will check all the boxes in rows that match a value in the first column of a table.

The example would be having the following formula on a button:

ModifyRows(TableName, TableName.CheckboxColumn,if(TableName.First Column=“Value”,“True”,“False”)

What am I doing wrong?

Hi Steve and welcome to the community! You’re not the awesome photographer are you? If so, I’m a fan! :slight_smile:

Erm, anyway. Does this help? It uses a single button to trigger a button on each row in a hidden column. Just select a colour in the dropdown and hit “Set”…

Hey Steve!

Looks like the ModifyRows action does not evaluate new column values on per-row basis. You need to split your action in two: check the checkbox on the rows where it needs to be checked, and uncheck on those that need to be unchecked.

Here’s a formula for the “Set” button in the answer above; no need for hidden buttons.

RunActions(
  ModifyRows([Table 1].Filter(Checkbox.Not() AND Value = Input_Colour), Checkbox, true),
  ModifyRows([Table 1].Filter(Checkbox AND Value != Input_Colour), Checkbox, false)
)

Generally if you needed to modify each row with individual values based on row data, you’d have to make that button column and press them all individually via RunActions(). But in your case of true and false this isn’t necessary.

3 Likes