Announcements
This site is in read only until July 22 as we migrate to a new platform; refer to this community post for more details.

Reset all other rows in the same column under certain conditions

I'm developing a trading journal for traders. In my app, I have a table called 'Fees' where users input their commission fees. There's a column named 'Default' (True/False) that determines whether a fee is the default choice. I want to simplify the user experience by automatically setting the 'Default' value to TRUE when a user selects 'Yes' while editing a record to make it the default fee. Currently, I use 'DefaultCounter' to prevent users from setting multiple default fees by showing an error message if they try. However, I'd like to further streamline the process. Is there a way to automatically set the 'Default' value to TRUE for the current record when a user chooses 'Yes,' while automatically setting the 'Default' value to FALSE for any other records where it's currently set to TRUE? How can I implement this?

Solved Solved
0 1 191
1 ACCEPTED SOLUTION

I've found the solution:

First, you need to create a new action that sets Default to FALSE if its value is TRUE.

  1. Create a new automation.
  2. Choose "Updates only" in Event Type, select the Fees table and set the condition: [Default] = TRUE.
  3. Add a process to this event with the type "Run action on rows", select the Fees table and insert the code in Referenced rows:

 

SELECT(
  Fees[Row ID], 
  AND(
    [Default] = TRUE,
    [Row ID] <> [_THISROW].[Row ID]
  )
)​

 

  • Select the previously created action in Referenced Action. 

View solution in original post

1 REPLY 1

I've found the solution:

First, you need to create a new action that sets Default to FALSE if its value is TRUE.

  1. Create a new automation.
  2. Choose "Updates only" in Event Type, select the Fees table and set the condition: [Default] = TRUE.
  3. Add a process to this event with the type "Run action on rows", select the Fees table and insert the code in Referenced rows:

 

SELECT(
  Fees[Row ID], 
  AND(
    [Default] = TRUE,
    [Row ID] <> [_THISROW].[Row ID]
  )
)​

 

  • Select the previously created action in Referenced Action. 
Top Labels in this Space