Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loop procedure

Status
Not open for further replies.

ksbrace

Programmer
May 13, 2000
501
US
Ok, so I have 2 tables sales_ppl and potential_clients. I want to assign the clients to the sales people in a round robin fashion to distribute them more evenly by state, etc.. like one client gets assigned to the first salesp_name, the second client ot the second salesp_name, third to the third. then, assuming I only have 3 sales people, the 4th should go back to the first, 5th to the second and all the say through the group

There is salesp_name (sales person's name) that is also in the potential_clients that links the two together.

In potential_clients, I have client_group column. When I get a new group of potential clients, they are assigned a group number and initially they are all assigned to 'HOUSE' as the salesp_name (sales person's name). so I want to assign X where salesp_name='HOUSE' and client_group='BMX234' one by one within the potential_clients table.

Thanks in advance for any and all help/advice/etc..

 
You'll need a new table that handles the matching. I usually call it Tbl1_To_Tbl2, in this case SalesPpl_To_PotentialClients. In that table will be a RowID, SalesP_Name, Client_Group, CreatedDate (or UpdatedDate). Any joins between Sales_Ppl & Potential_Clients go through this table. The actual updates to this table probably need to happen on the client side so you can have control to make changes (if someone is sick and the round robin needs to skip the client this time or whatever).

The dates will help track sorting for who was last assigned, etc.

I'm not sure how much automation you need, but hopefully this will get you started.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top