Count the number of orders I've assigned to each of my pickers

Hello, I’d like to explain my problem. In my application, I have a database with all the orders made by the users. Then, with this database, I choose which salesperson I’m going to assign to it. I select which salesperson to assign to which order and then press a button to delete the order from its database and create a new database with the name of each salesperson and the name of what was ordered. The sellers themselves are now registered in another database with their names. The problem is that I can’t keep track of how many orders I’ve assigned to each salesperson. How can I find out from this how many orders I’ve assigned to which salesperson? Thank you very much, you would be a great help.

I haven’t seen your full setup but deleting the order and creating new record is often not a good way of setting this up.

I’d have a relationship between salesperson and orders (a salesperson can have many orders, an order can only have one salesperson).

Then you just assign order to a salesperson.

Then when you look at each salesperson you can go to salesperson > orders > count. You can filter that count further, for example ‘order completed’ = false.

Ok great, thank you very much.
I still have a question about this sentence “I’d have a relationship between salesperson and orders (a salesperson can have many orders, an order can only have one salesperson).”
So do I need to create two new linked properties, one in the orders property linked to the salespersons and one in the salesperson property linked to the orders ? And to assign a salesperson to an order, do I fill in the orders linked property? (dk if that’s understandable)
Thanks a lot for your answer, it’s really helpful! :slight_smile:

When you set up a relationship, it already appears in both collections. Be sure to rename your relationships immediately, so that you don’t lose track later.

So you should be able to do an update action on current order, go to the user relation field (maybe you renamed this relationship “assigned-salesperson”), and it will let you ‘add current user’. But to have current user, you will need a list of users, or another way to access the data if that makes sense.

Thank you so much, it worked fine.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.