March 12, 200421 yr I know I've seen threads on this before, but I cannot find it... I have the follwing loop: Go to Record/Request/Page (First) Loop If (cPrimaryRecord="1") Set field (cFamily,"1") else Omit record End if Go to Record/Request/Page (Next, Exit after last) End Loop This loop reuires me to perform it twice to remove all of the duplicates. It seems to leave the last record alone witha "0" in the cPrimaryRecord... thanks Version: v6.x Platform: Mac OS X Jaguar
March 12, 200421 yr When you omit or delete records in a loop, you have the problem that you automatically go to the next record. So you don't need to execute the go to next record step after you omit a record. It's generally a lot simpler to simply mark the duplicate records by setting the value of a field, and then later do a find to omit the duplicates. Another option is to start at the last record and then loop backwards. But, it seems to me that this may also fail if the first record is a duplicate.
March 13, 200421 yr Bob's given a fair summation of the problem. But 'marking the duplicate records by setting the value of a field' is not generally a good idea in multi-user solutions. Moreover if you are trying to locate single instances of duplicated values in a found set (rather than across the whole file) it's not so simple even in a stand-alone situation. However if you'd like to look at an example of a script which achieves the isolation of unique values without marking records, you might be interested to pay a visit to: http://www.nightwing.com.au/FileMaker/demos5.html#d3 to download the demo which appears under the heading 'Finding only one of each record when there are duplicates!' It uses an additional piece of logic to resolve the looping dilemmas that Bob has described.
March 15, 200421 yr This will work better: Go to Record/Request/Page (First) Loop exit loop if status(currentFoundCount) = 0 If (cPrimaryRecord="1") Set field (cFamily,"1") Go to Record/Request/Page (Next, Exit after last) else Omit record # you are now on the next record End if End Loop
Create an account or sign in to comment