Starting View

Hello,

I have two views โ€œMy Jobsโ€ and โ€œLoadsโ€. How can I do for the app to start with โ€œMy Jobsโ€ if the user is a driver and โ€œLoadsโ€ if the user is a supervisor.

Thanks in advance for your help!

Solved Solved
0 7 2,605
1 ACCEPTED SOLUTION

I assume youโ€™ve got a Users table, and in that table youโ€™ve got two things:

  1. a column holding the email that the user will use to log in; and
  2. a column holding the role of the user.

If these conditions are true, then thereโ€™s two good ways to handle this:

  1. LOOKUP(USEREMAIL(), Users, User_Email, User_Role); or
  2. Create a slice on the users table, with a condition that matches the USEREMAIL() = [User_Email], call it Current_User - from here you can always easily call any information from the current userโ€™s record: any(Current_User[Any_Column])

Either way you can now call data from the specific userโ€™s record and make determinations with it.

Switch(any(current_user[User_Role]),
  "Driver", "My Jobs", 
  "Supervisor", "Loads", 
  "Some fallback/default view"
)

or

If(
  any(current_user[User_Role]) = "Driver", "My Jobs", 
If(
  any(current_user[User_Role]) = "Supervisor", "Loads", 
"Some fallback/default view"
))

or

IFS(
  any(current_user[User_Role]) = "Driver", "My Jobs", 
      any(current_user[User_Role]) = "Supervisor", "Loads"
)

To use the LOOKUP() instead of the Current_User (Slice) just replace the any(current_user[User_Role]) portion of any of the formulas above

IFS(
   LOOKUP(USEREMAIL(), Users, User_Email, User_Role) = "Driver", "My Jobs", 
       LOOKUP(USEREMAIL(), Users, User_Email, User_Role) = "Supervisor", "Loads"
)

View solution in original post

7 REPLIES 7

If you check under UX>Options you find a setting for just that thing
2X_2_21cb9be8ff1c783afc0c68f9b7b43eac89e991a6.png

Hi @MultiTech_Visions thanks for your response. Iโ€™m aware of this setting but I can not find the right expression to make it work.

I assume youโ€™ve got a Users table, and in that table youโ€™ve got two things:

  1. a column holding the email that the user will use to log in; and
  2. a column holding the role of the user.

If these conditions are true, then thereโ€™s two good ways to handle this:

  1. LOOKUP(USEREMAIL(), Users, User_Email, User_Role); or
  2. Create a slice on the users table, with a condition that matches the USEREMAIL() = [User_Email], call it Current_User - from here you can always easily call any information from the current userโ€™s record: any(Current_User[Any_Column])

Either way you can now call data from the specific userโ€™s record and make determinations with it.

Switch(any(current_user[User_Role]),
  "Driver", "My Jobs", 
  "Supervisor", "Loads", 
  "Some fallback/default view"
)

or

If(
  any(current_user[User_Role]) = "Driver", "My Jobs", 
If(
  any(current_user[User_Role]) = "Supervisor", "Loads", 
"Some fallback/default view"
))

or

IFS(
  any(current_user[User_Role]) = "Driver", "My Jobs", 
      any(current_user[User_Role]) = "Supervisor", "Loads"
)

To use the LOOKUP() instead of the Current_User (Slice) just replace the any(current_user[User_Role]) portion of any of the formulas above

IFS(
   LOOKUP(USEREMAIL(), Users, User_Email, User_Role) = "Driver", "My Jobs", 
       LOOKUP(USEREMAIL(), Users, User_Email, User_Role) = "Supervisor", "Loads"
)

It worked!! thanks a lot for that.

Youโ€™re welcome

I am working on the exact same thing here.
However I am not returning the starting screen with the view I am trying to associate.
Here are 2 expressions: (Note that User_Role is User_Team for my app)
Switch(any(current_user[User_Team]),
โ€œAdminโ€, โ€œRepair Neededโ€,
โ€œRedโ€, โ€œTakedown Ready: Red Teamโ€,
โ€œCustomer Mapโ€
)

If(
any(current_user[User_Team]) = โ€œAdminโ€, โ€œRepair Neededโ€,
If(
any(current_user[User_Team]) = โ€œRedโ€, โ€œTakedown Ready: Red Teamโ€,
โ€œCustomer Mapโ€
))

Solving my own problem here:
the โ€œ:โ€ in the View name created an issue.
Delete the Colon form the views title fixes the issue.

Top Labels in this Space