I’m having some trouble implementing a dropdown that depends on the value that is currently saved in the field of the dropdown.
The feature I want to implement:
In a table called ‘projects’ where each row is a project, I want the dropdown for the stages to be dependent on the current stage. For example: if I am in stage 2, I want the dropdown to show:
- Stage 1
- Stage 2
- Submit for stage 3 approval
My (flawed) implementation:
I’ve created a table called ‘Stages’ containing all the possible stages, and the values the dropdown should show when in a certain stage.
I then used the following code in the ‘Valid If’ field of the stages column of the projects table (explained below):
(where the if statement accounts for the case a new project is added (through a form) and the stage should be fixed to Stage 1)
The second list is called when in the edit screen and looks up the correct previous, current and next stages in the Stages table to show in the dropdown.
Note that I refer to [Old stage] in the projects table instead of [Stage], as explained below.
When I used [Stage] instead of [Old stage] in the Valid If statement, the values of the dropdown would change as soon as I picked a new stage (which should only happen after saving the changes). If for example I cleared the stage, the dropdown would only show 3 blank options. Also, if I am in stage 3 and click stage 2, the new options would become stage 1, stage 2 and submitted for stage 3 approval. The only way to go back to stage 3 would be to discard the edit. I solved this by creating the [Old stage] column, that holds the stage before the edit.
The only issue here is that an updated stage will update the [Stage] column in the sheet at the next sync, which will then update [Old stage] because of the formula in the sheet itself (see screenshot), which then has to be read by Appsheet again at the next sync. As a result the ‘Stage’ column is not visible when I reopen the edit in the first 10 to 15 seconds after saving a new stage.
Is there a better approach that allows me to keep the same functionality while eliminating the delay on reopening the edit screen?
Thank you very much for your help!