Process Rows if condition is met
Hi all,
I have been asked to develop something in CF. I am new to the world of CF development and trying to learn as best I can.
I am using CF8 as that is all that is available in my work environment.
I have posted my requested here in the hope someone can assist and give some pointers.
We have a system which records login and logouts for computers on our campus. I need to work out how long each computer has been used for and we can't change what the program logs as it is a third party tool used for managing the network.
I have got to a point where I can get the time calculations if a user logs in and logs out once a day or multiple times on different computers. I do this by creating two queries one with retrieves the logins and one which retrieves the logouts. I then do an if statement which matches the MacStudent and if the ID for the logout is greater than the ID of the login which works although it may be overkill and probably not best practice!
However my main issue is when a user logs in and out of the SAME computer multiple times in a a single day. I cant figure out a way of identifying which login relates to which logout programatically.
So for testing purposes say I have the following records retrieved:
I need to be able to loop through all the records and then calculate time between a login event and only the NEXT logout event.
So for the example recordset above - I would expect to calculate 25 mins use recorded. but at the moment i cant figure out how to ignore the rest of the logouts as when i do my loop it takes the first login and calculates the time against ALL the logouts, then moves to the second login event and calculates the time against ALL the logouts below that and it carries on until the loop finishes.
I hope that makes sense to someone and any help appreciated!
Thanks in advance!
