I have a form that creates documents in the background–a time entry form where people enter time for various jobs on various dates–the time is saved in a separate document based on the job and month. I use one form to create various documents in the background.
I don’t want more than one time sheet for each job for each time period so I was using the GetDocumentByKey to see if the time document already exists, then either create a new time sheet, or append the new data to the existing time sheet.
However, it seems that GetDocumentByKey sometimes did not find newly-created time sheets and would create a new one (as if the view did not have time to refresh). So I changed to using Db.Search (each time sheet document has a field with a string indicating User, Job and Time Period, so the search formula is fairly simple.
But I am concerned about performance as the Db grows. I can limit the number of documents in a view by “expiring” time sheets over 6 months old, so the GetDocumentByKey would only have a subset of documents to search through, whereas the Db.Search will have to search all documents every time.
Am I wrong in thinking that the GetDocumentByKey may miss newly-created documents (maybe created within the past few minutes?). Perhaps something else in my formula is wrong? Most of the time the GetDocumentbyKey worked correctly, but a few times it didn’t.
Subject: RE: GetDocumentbyKey not finding newly created documents, use Db.Search instead?
Hi. i have a very similar problem, but with me, it only fails in a couple entries. i am getting the data from a sql database, to run a loop, that creates and modifies documents.Here’s the creepy thing. if i move the lines in my SQL database, so the ones that give me problems are at the end of the query… it works!!