I have a field called “JobID” that needs to be unique in the notes database. My plan is to search the database for a document’s JobID and ,if it is equal to the current document’s JobID, alert the user and cancel the save. I can’t seem to figure out how I would do this though.
Share
You could shorten your code a bit, there is no need to loop through all documents…
db.Search is very slow, I would use a view lookup instead. You could use db.FTSearch, but if the full-text index is not up-to-date, you will not get the correct return value.
So just create a hidden lookup view with the job ID as the first and only column (sorted).
You should also declare session/db/etc in your function. Make sure you always use Option Declare…