Hello,I have a database in which the users register their time on projects.
Currently there is no error checking to stop the users from placing two time entries in which the sum of which would be greater than 8 hours.
I have a view of the documents Categorized by the Employee. The view has two other columns date (pulled from the date field on doc) and hours(pulled from the hours field on the doc)
What I am trying (unsure if it will work) is to in a postsave event have a GetAllDocumentsbyKey(date) ← using the date field. Get the total of the columnvalue for hours for that date. If the sum of this plus the existing documents field value for hours is greater than 8 I want to give the users a messagebox and cancel the save.
I’m not sure how you are entering your ‘time spent’ value, but this would work for hours. You could get the user to enter minutes and test against 480 minutes.
I see only one issue the part of the search string
workDate = @Today the form the users are filling out has a date picker to choose to put the hours on another day. Currently with the @today no mater what date they choose in the date field they get the 24 hour message
Is there a way aroud this? Will the searchFormula and document collection work with FieldGetText on the Date field?
one thing, always check the UNID of the document you are saving against the document from the collection, that way you won’t add the same hours twice (in the case of an edit and not a new doc).
Helloyou are right I have that exact issue now. I am very green at this. How would i get stated checking the unid of the document. I have an if statement now for existing docs.