Select between two lists of ENUM buttons based on the previous column response

Hello people, I need to know how to select between two sets of ENUM buttons to show in my Form, based on the response given in the previous column, before saving the entry. This is how it works: the user chooses a task to do and before they want to start a new task, they must select the task END. After that, when they start filling out the Form again the entire list of options will show. Therefore, there are two sets of ENUM buttons:

(1st set) TASK1, TASK2, TASK3, TASK4

(2nd set) END

To do this, I have two tables A (user, task) and B(tasks). I have also a slice: SliceA(user, last task selected).

So, when the user types their user data in the form, the second column will show the task options. If the sliceA shows the last task the user typed was END, then it should show the 1st set of tasks (this means the user has already finished their task and is ready to take a new one. If the sliceA shows that the user is still doing a task (anything different than END), then the list of ENUM buttons must show only one option which is END (2nd set).

I appreciate your help!

Solved Solved
1 2 57
2 ACCEPTED SOLUTIONS

To achieve this functionality, you can set up conditional ENUM button options in your form based on the user's last task selection. Here's how you can implement this in a step-by-step manner:

1. Table Structure

  • Table A (User Tasks):

    • Columns: User, Task
    • This stores all task selections by the users.
  • Table B (Tasks):

    • Columns: Task
    • Contains the task options: TASK1, TASK2, TASK3, TASK4, and END.
  • SliceA (User's Last Task):

    • Create a slice from Table A with the following formula:
      MAXROW("User Tasks", "Timestamp", [User] = USEREMAIL())
    • This gives the latest task entry per user.

2. Enum Column Configuration

In your form, configure the ENUM column for task selection as follows:

Show ENUM Buttons Dynamically:

  1. Column Definition (Task Selection):

    • Type: Enum
    • Source: Table B
  2. Valid If Expression: Use the Valid If field to dynamically filter the tasks shown based on the last task:

    IF(
      LOOKUP(USEREMAIL(), "SliceA", "User", "Task") = "END",
      LIST("TASK1", "TASK2", "TASK3", "TASK4"),
      LIST("END")
    )

3. Explanation of the Expression

  • LOOKUP(USEREMAIL(), "SliceA", "User", "Task"):
    Fetches the last task selected by the current user.

  • IF Statement Logic:

    • If the last task is "END", it shows the 1st set of options (TASK1, TASK2, TASK3, TASK4).
    • Otherwise, it shows only "END" as the available task.
  • LIST:
    Specifies the options to display dynamically.

4. Additional Settings

  • Required Field: Ensure the task selection column is marked as required in your form.
  • Save Behavior: Test the form behavior to verify that task options update appropriately after the user completes a task.

This approach ensures the ENUM buttons dynamically adapt to the user's progress while maintaining the workflow integrity. Let me know if you need help refining any part!

View solution in original post

I already found the answer. In the A table form edit screen, I selected the Task field and typed this below in the (Data Validity) --> (Valid-If) field.

=IF(LOOKUP([_THISROW].[user],"SliceA","user","last task selected")="END",{"TASK1","TASK2","TASK3","TASK4"},{"END"})

View solution in original post

2 REPLIES 2

To achieve this functionality, you can set up conditional ENUM button options in your form based on the user's last task selection. Here's how you can implement this in a step-by-step manner:

1. Table Structure

  • Table A (User Tasks):

    • Columns: User, Task
    • This stores all task selections by the users.
  • Table B (Tasks):

    • Columns: Task
    • Contains the task options: TASK1, TASK2, TASK3, TASK4, and END.
  • SliceA (User's Last Task):

    • Create a slice from Table A with the following formula:
      MAXROW("User Tasks", "Timestamp", [User] = USEREMAIL())
    • This gives the latest task entry per user.

2. Enum Column Configuration

In your form, configure the ENUM column for task selection as follows:

Show ENUM Buttons Dynamically:

  1. Column Definition (Task Selection):

    • Type: Enum
    • Source: Table B
  2. Valid If Expression: Use the Valid If field to dynamically filter the tasks shown based on the last task:

    IF(
      LOOKUP(USEREMAIL(), "SliceA", "User", "Task") = "END",
      LIST("TASK1", "TASK2", "TASK3", "TASK4"),
      LIST("END")
    )

3. Explanation of the Expression

  • LOOKUP(USEREMAIL(), "SliceA", "User", "Task"):
    Fetches the last task selected by the current user.

  • IF Statement Logic:

    • If the last task is "END", it shows the 1st set of options (TASK1, TASK2, TASK3, TASK4).
    • Otherwise, it shows only "END" as the available task.
  • LIST:
    Specifies the options to display dynamically.

4. Additional Settings

  • Required Field: Ensure the task selection column is marked as required in your form.
  • Save Behavior: Test the form behavior to verify that task options update appropriately after the user completes a task.

This approach ensures the ENUM buttons dynamically adapt to the user's progress while maintaining the workflow integrity. Let me know if you need help refining any part!

I already found the answer. In the A table form edit screen, I selected the Task field and typed this below in the (Data Validity) --> (Valid-If) field.

=IF(LOOKUP([_THISROW].[user],"SliceA","user","last task selected")="END",{"TASK1","TASK2","TASK3","TASK4"},{"END"})

Top Labels in this Space