Hi folks,
Somehow, I have a GlobalValue in my database that has somehow not incremented to a unique value all the time ... so I'd like to put some code in my database to loop and increment the global ID up by 1 until it finds a unique value.
I know how to write a loop, but not a conditional 'keeping looping till I get a unique value'. Can someone give me a hand with this?
Here's my existing (not verifying unique value) code:
vRSHandle = @XResultSetNew(@FN, "Debtors!DRNotes")
if (vRSHandle > -1)
{
vNewFileID = @ToNumber(@GlobalValue("gFileID")) + 1
GlobalValue("gFileID", vNewFileID)
XResultSetCreateNewRecord(vRSHandle)
XResultSetValue(vRSHandle,
"DRNoteID", vNewFileID, "DRNoteRef", DBID, "DRNoteDate", vserverdate, "DRNoteTime", @servertime(), "DRNoteClt", DBCltNo,
"DRNoteSig", @UserID, "DRNote", aNote)
XResultSetClose(vRSHandle)
DBWorked = vServerdate
FormCommit("")
if ((@Visibility(NotePanel) = 1) and (aRedraw = 1)) then ForceRedraw()
}