CHANGE GROUPING/ORDER OF A VIEW DEPENDING ON THE USER. IT'S POSSIBLE?

Dear colleagues, I don't know how to solve this:

- A customer table, each customer is assigned to a salesperson.-
- A view with the list of clients

When a salesperson enters the app and goes to the customer list view, all the customers assigned to this salesperson should appear first, and then the rest of the customers assigned to another salesperson.

I'm thinking but I can't think of how to do it... with a virtual column it doesn't work, because the virtual column belongs to the client... and it can't change depending on the seller.

Any idea? Thank you

Solved Solved
0 6 125
2 ACCEPTED SOLUTIONS

Thank you. I think I have understood the requirement. My query was how a salesperson gets assigned to the Customer?  There should be some column ( name  , reference to Salespersons table or email of assigned salesperson) in the Customer table to assign the salesperson.  If there is an email column corresponding to a salesperson , then you could sort the Customer records by the help of email column with an additional VC.

Could you mention which column identifies the assigned salesperson?

In general, assuming there is a [Salesperson_Email] column in the Customer table for the assigned salesperson, please add another text VC called say [By_Salesperson] with an expression something like

IF([Salesperson_Email] =USEREMAIL(), "My Customers", "Not My Customers")

Then please sort the Customers summary view by  [By_Salesperson] column ascending. This should give the logged in salesperson's customer's to the respective salesperson.

View solution in original post

I request you to again go through my suggested approach and test with different users in different devices.


@evadeumal wrote:

, but the virtual columns are the same for all users,


 

No, the suggested expression in the virtual column is such that it will evaluate differently in the logged in device for each user because it is USEREMAIL() based.

I tested the suggestion for 3 different users and it perfectly sorts as per user email.  We even use this technique of USEREMAIL()  in hiding and showing certain view to certain users  , slicing records of a table based on useremail , column constraints such as valid_if, editable_if, show_if and so on. In summary, USEREMAIL() is a one of the powerful tools to present user prioritized information in the app.

Below are the customers sorted for user A in test app

Suvrutt_Gurjar_0-1708746267251.png

Customers sorted for user B 

Suvrutt_Gurjar_1-1708746319832.png

You can see that the sorting is different. 

 

View solution in original post

6 REPLIES 6

Could you update if the assigned salesperson's email exists in the Customer table? Meaning if customer A, B and C have salesperson T , then does  T 's email exists in the records of customers A , B and C in Customer table?

Thanks for the response, but that's not the problem.
We assume that the salespeople are already assigned to the clients.
I don't need to check if they exist, just have a list type view where the first customers are those assigned to the seller who is accessing the view (app user)

I don't know if I'm explaining myself well ๐Ÿ˜ถ

Thank you. I think I have understood the requirement. My query was how a salesperson gets assigned to the Customer?  There should be some column ( name  , reference to Salespersons table or email of assigned salesperson) in the Customer table to assign the salesperson.  If there is an email column corresponding to a salesperson , then you could sort the Customer records by the help of email column with an additional VC.

Could you mention which column identifies the assigned salesperson?

In general, assuming there is a [Salesperson_Email] column in the Customer table for the assigned salesperson, please add another text VC called say [By_Salesperson] with an expression something like

IF([Salesperson_Email] =USEREMAIL(), "My Customers", "Not My Customers")

Then please sort the Customers summary view by  [By_Salesperson] column ascending. This should give the logged in salesperson's customer's to the respective salesperson.

Yes, I already thought about doing something like that, but the virtual columns are the same for all users, so if two or more sellers access the app at the same time... that virtual column would conflict, because it cannot have the values of the two users at the same time.
That's why I don't know how to solve it ๐Ÿค”

I request you to again go through my suggested approach and test with different users in different devices.


@evadeumal wrote:

, but the virtual columns are the same for all users,


 

No, the suggested expression in the virtual column is such that it will evaluate differently in the logged in device for each user because it is USEREMAIL() based.

I tested the suggestion for 3 different users and it perfectly sorts as per user email.  We even use this technique of USEREMAIL()  in hiding and showing certain view to certain users  , slicing records of a table based on useremail , column constraints such as valid_if, editable_if, show_if and so on. In summary, USEREMAIL() is a one of the powerful tools to present user prioritized information in the app.

Below are the customers sorted for user A in test app

Suvrutt_Gurjar_0-1708746267251.png

Customers sorted for user B 

Suvrutt_Gurjar_1-1708746319832.png

You can see that the sorting is different. 

 

Oh my God! You're right! It works! ๐Ÿ‘๐Ÿ‘
The virtual column is customized for each USEREMAIL().
Brilliant! I didn't know it was like that 
Thanks you so much  for your help ๐Ÿ’š๐Ÿ’š๐Ÿ’š

Top Labels in this Space