Template
At Most One Value True
Valid_if to enforce column to have only one true value
Industry:
n/a
This app has a yes/no column called Status. It demonstrates how to make it so at most one row in the table has Status set to true. Try editing the Status value of multiple rows and see what happens.
Loading...
Also see:
tablet mode & fullscreen mode
How we built this app
To do this, we added the following formula to the valid_if of Status:
OR(
[Status] = FALSE,
COUNT(
FILTER(
"Data",
AND(
[Key] <> [_THISROW],
[Status] = TRUE
)
)
) = 0
)
If the current row's Status is set to FALSE, then the row will be valid (since an unlimited number of rows can have Status = FALSE). If the current row's Status is set to TRUE, then the row will be valid if there are 0 other rows whose Status is TRUE.
This is a preview of the data sets used in the app.
Data
This is a high-level model of both the data entities and the UI elements in the app.
Loading...