Good Morning,
I am currently trying to write some LotusScript in my forms querysave to prevent duplicate entries. Here is the situation:
I have 5 fields
-
First Name
-
Last Name
-
Start Date
-
End Date
-
Duty Status
I am trying to make sure the user does not input a troopers daily information twice. However, A trooper can work more than once on the same day, but he would always have to have a different Duty Status.
Here is what I am doing so far, any suggestions would be appreciated.
First I initialize the fields, then I set some variables:
Dim docStatus As String
docStatus = uidoc.FieldGetText( “DutyStat” )
I do this for the 5 fields.
So then I created a view to capture daily input and so this script can check against it for duplicate entries.
Set view = db.GetView( “DuplicateChecker” )
Set dc = view.GetAllEntriesByKey( docStatus, True)
I am just gonna check duty statuses and compare the first and last name, start date and end date.
If dc.Count = 0 Then
Exit Sub
Else
If it doesn’t find anything it will just exit, but here is where it gets hazy for me, how do I check the other 4 entries in my view against what is currently being input. That is, if the duty status is the same, and so is the start date, end date, first name and last name, I need to kick out an error message saying that this could be a duplicate entry, please make sure the duty status is correct, or make sure you are not inputting duplicate information.
any help would be appreciated.
thanks,
stephen