Need help with complex SELECT / DEFERENCE /IN? setup.

JLC
Bronze 3
Bronze 3

I have an app that needs to have a dynamic "assigned to" user.  

I think I need to have a Select expression but I am not sure how to set this up. I have a status table with a role column that could be one or more roles.  Users are assgined to one role.  I have a contacts table where the contacts can be assigned a status, one or more managers and a reviewer.  I want to be able to assign the contact to either the manager(s) or the reviewer based on the status.   How do I get the correct User in the Assigned To field?  

 

StatusRole
NewA
PendingA
Step1A,B
Step2C
CompleteC
  
UserRole
User1A
User2A
User3C

 

ContactsStatus (REF) Managers (ENUMLISTReviewer (EMUM)AssignedTo
Some Contact1NewUser1,User2User3User1,User2
Some Contact2Step2User1User3User3
Solved Solved
0 6 187
1 ACCEPTED SOLUTION

Aurelien
Google Developer Expert
Google Developer Expert

OK, thank you for further explanation.


@JLC wrote:

I only want to return Manager or Reviewer based on the status.


Can you try this instead:

FILTER("USER", 
  AND(
    CONTAINS([_THISROW].[Status].[Role],[Role]),
    CONTAINS(CONCATENATE([_THISROW].[Reviewer],[_THISROW].[Manager]),[idColumnUser])
  )
)

 


@JLC wrote:

Should this formula go in Appformula OR initial value?


App Formula, definitely.


@JLC wrote:

I want this to dynamically set the assigned to.


Then, you would prefer using a virtual column instead of a real column.

Because you said you need it to be written, then you may want to build a mechanism with a bot for example, to refresh data value with an action everytime a user has been updated.

View solution in original post

6 REPLIES 6

Aurelien
Google Developer Expert
Google Developer Expert

Hi @JLC 

What about:

 

FILTER("USER", 
  CONTAINS([_THISROW].[Status].[Role],[Role])
)

 

For reference:

FILTER() - AppSheet Help

CONTAINS() - AppSheet Help

That returns a list datatype but this is not a virtual column.  I could change my schema to remove the assigned-to column and make it virtual. However, I need the assign-to as a field in my db for other processes. Can I wrap that in a string formula to return text value?

Aurelien
Google Developer Expert
Google Developer Expert

@JLC wrote:

That returns a list datatype but this is not a virtual column. 


I'm not sure of your need.

If you wish to have it set as a real column, it does not work when you edit your contact ? Normally, real column are re-calculated when editing - while virtual column are calculated on the fly.

JLC
Bronze 3
Bronze 3

Ok, If I understand correctly this will filter Users for the matching role in the Status table. However, this would return ALL users for that role. I only want to return Manager or Reviewer based on the status. Do I need to do a filter of a filter? In regards to the list datatype. Should this formula go in Appformula OR initial value? I want this to dynamically set the assigned to. The user only sets the contact status. They cannot set the assign-to manually. I don't want to return a list of option to select the user, I want the app to return the value on who should be assigned to the manager or review based on the role in status.

Aurelien
Google Developer Expert
Google Developer Expert

OK, thank you for further explanation.


@JLC wrote:

I only want to return Manager or Reviewer based on the status.


Can you try this instead:

FILTER("USER", 
  AND(
    CONTAINS([_THISROW].[Status].[Role],[Role]),
    CONTAINS(CONCATENATE([_THISROW].[Reviewer],[_THISROW].[Manager]),[idColumnUser])
  )
)

 


@JLC wrote:

Should this formula go in Appformula OR initial value?


App Formula, definitely.


@JLC wrote:

I want this to dynamically set the assigned to.


Then, you would prefer using a virtual column instead of a real column.

Because you said you need it to be written, then you may want to build a mechanism with a bot for example, to refresh data value with an action everytime a user has been updated.

Ok I got this to work with setting the IDColumnUser to the same value in the Manager / Reviewer columns.  

I think I am good to go.  Thanks for your help!

Top Labels in this Space