Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread Help needed..
Sun, Jul 10 2022 11:32 PMPermanent Link

Ian Branch

Avatar

Hi Team,
I need some suggestions please...
I have a routine in an App that generates and emails multiple reports.  Some are Daily reports, Weekly reports, and Monthly reports.
Could be anything up to 23 reports generated and emailed on the first day of the week of the month.
These reports are generated for each of 3 companies and running the reports for a particular company is triggered by the first opening of an App by an authorised user.  Based on their authorised USERID.
The three companies can generate & email reports at the same time.  Doesn't usually happen but is possible.  This could mean up to 69 reports being generated and emailed in parallel.  Again, rarely happens.
The App can be accessed/run via LAN, RDP or WEB (Thinfinity).
At the end of successfully sending each individual report a table is updated with the current date/time to indicate successful sending.
Currently there are two Users duly authorised for each Company.
Unfortunately they have experienced conflicts where both the Users from one Company have logged in to the App within a few moments/minutes of each other and the second has started the process while the first was still collating/generating/emailing reports. Frown
What I need are suggestions of a positive, hopefully fool proof, way to prevent User 2 from starting the process when he/she opens the App, if User 1 has already started it in his/her App.  
It would need to be able to handle say User 1 not completing the process due to say a loss of connection such that it can be picked up again when either User1 or User 2 opens the App next time.

Thoughts, Ideas, Suggestions appreciated.

Regards & TIA,
Ian
Mon, Jul 11 2022 2:00 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Ian


Briefly:

1. create a queue (say an ElevateDB table, but could be a simple text file)
2. user check queue and only makes an entry if there isn't an open one in there
3. job runs - checks queue if anything there processes it, if not goes to sleep for a while.
4. reports produced close queue entry - could be delete or add completed date/timestamp

Roy Lambert
Mon, Jul 11 2022 9:38 AMPermanent Link

Raul

Team Elevate Team Elevate

On 7/11/2022 2:00 AM, Roy Lambert wrote:
> 1. create a queue (say an ElevateDB table, but could be a simple text file)
> 2. user check queue and only makes an entry if there isn't an open one in there
> 3. job runs - checks queue if anything there processes it, if not goes to sleep for a while.
> 4. reports produced close queue entry - could be delete or add completed date/timestamp


Basically what Roy said with small difference

1. use table with date, start, end time and user id

2 first user logging in can check if record exists for a given month

2.1 if NO then adds entry with current time, their user and starts
running reports

2.2 if YES and there is no end time (meaning run is not complete) :
a. if own ID then resume running (own user did not complete)
b. if other user ID then check start time and if it's within allowed
timeout do nothing (do not run since other users is running already)
c. if other user ID and start time past timeout assume other user failed
: update record to own id and start running

3. once app completes it marks the end time


If reports are resume able then could add a status column to table
indicating what steps are complete so would not have to run all from
start (and update status after each report completes or such)


Raul
Mon, Jul 11 2022 10:57 PMPermanent Link

Ian Branch

Avatar

Tks Roy & Raul,
I have made a mix of your ideas.  I await to see how it pans out with the User.
Regards & Tks again,
Ian
Image