marking instances of matching records
i'm trying to tweak this script to work.
The idea is that as a user is inputting data on a new record, I have a script that will tell them if the person they are entering has any previous records (not uncommon, and we need to keep all of them). The script searches for a matching previous one (indicated with an "X" in the "Mark" field), then performs a find that pulls up the new record and any matching and returns the user to the new record to finish entering data, but allowing them to see matching entries in the found set. I have everything working except...
I want it to make an "X" in the Mark field if there are other records for that person, and keep it blank if there are not other records. For the sorting process I have the script mark a "D" in the mark field while searching so as to separate it from all other members that have multiple records, and after the search is complete replace it with an "X" for multiple records and "" for single records. Script pasted below.
("dummybox" is a hidden, multi-purpose temporary use box for scripts such as this)
Perform script [“script that goes through entire database and marks matching records with a D”]
Perform find (all records with D)
Sort by date
Go to first
Replace field contents [Mark; “X”]
Replace field contents [dummybox; serial numbers]
Go to next, exit after last
Replace field contents [Mark; If (dummybox=”1”; “”; “X”) ]
And then i clear the dummybox for future use.
The problem is this also clears the "X" from the earliest instance of a matching record, but I only want it to clear the "X" if there are NO matching records!
I'm sure there's better ways to do this. Suggestions?