crazybake Posted March 12, 2004 Posted March 12, 2004 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
BobWeaver Posted March 12, 2004 Posted March 12, 2004 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.
CobaltSky Posted March 13, 2004 Posted March 13, 2004 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.
bruceR Posted March 15, 2004 Posted March 15, 2004 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
Recommended Posts
This topic is 7562 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now