Normal Topic Get next available record help needed. (Read 610 times)
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Get next available record help needed.
May 3rd, 2014 at 11:59pm
Print Post Print Post  
I have a pool of people that need to be contacted based on a specific criteria. when I have only 1 person contacting them I just create a command button that generates a result set and the user presses it and just works the records.

When I have had a few people doing it, I would divvy up the records with the users id and then add userid to the search button and all would be good.

My problem now is I have a need to have many people work a list and do not want to initially assign a user to the pool of records, I just want a user to get the next available record and once they start working it I will have code assign it to them.

My problem is that when multiple people  press a command button without the unique user Id they all get the same list and the record locked feature gets a big workout (not sure if that is a problem) I think a better solution would be to have a button that only retrieves 1 available record at a time, and each time the user is ready to contact another record they would press the button again.

I believe my best solution would be to have a field that is used to show the record is available and when the command button is pressed it would loop through the records and grab just 1.
I am not sure the best  way to loop through the records to get just one.

Any thoughts on a better method or idea on best way to get 1 at a time would be greatly appreciated.

Thanks
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Get next available record help needed.
Reply #1 - May 5th, 2014 at 2:27pm
Print Post Print Post  
Hello Robert,

I think the following will work for you. Use @XResultSet() to get all the records that need to be processed. Loop through that resultset until you find one that is not locked. Get the unique ID(Assuming you have one) from that record, do not move off of or close this resultset at this point as we need to hold the lock. Open a second resultset that is just that record. Use XResultSetOpenForm to open the form with that second resultset. Then close the first and second resultset.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Get next available record help needed.
Reply #2 - May 5th, 2014 at 4:09pm
Print Post Print Post  
You might also consider using a GlobalValue to hold a list of the records that need to be updated (by unique ID). As each client handles a record, it removes it from the list -- updating the list.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Get next available record help needed.
Reply #3 - May 5th, 2014 at 7:17pm
Print Post Print Post  
Ray, Mark,

Thanks so much for the ideas! I really appreciate the help.

I think I really like Mark's thought a lot.  If I understand correctly I could basically:

Create 2 global values like Get and Take

create a new field for GetNTake in the records

use a mass update that uses the get global value to create a unique sequential increasing number. This would also keep track of the number so when I add more records It knows where to begin.

create a retrieve spec that retrieves the next Take Global value

Create a command button that runs the retrieve spec and increases the take global value by 1.

So each time the button is pressed  it retrieves just 1 record. This would be a fast search!

I realize that this is a simplistic view and that I need to clear retrieve specs and do a bunch of other things but it sure seems like a very doable solution.

Thanks so much
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged