2 Replies Latest reply on Apr 7, 2009 1:02 PM by agprevite

    Need help with a Find Duplicates script ~ Beginner

    agprevite

      Title

      Need help with a Find Duplicates script ~ Beginner

      Post

      Howdy,

       

      I am trying to find/remove duplicates from a FM 9 database I created. I was able to find a script that would help in doing this but I am still a beginner and am having a hard time with it. I have everything linked through a unique ID number so at least I have step 1 correct. Where I am running into the issue is within the script commands

      Here is the one I found:

       

      Show All Records

      Sort Records [Restore, No Dialog] sort by ID in ascending order

      Go to Record /Request/Page [First]

      Replace field contents [No Dialog, 'Mark', '''']   - This is where it begins to lose me, how do I add the '''' and what does it mean?

      Set Field ['global', 'ID'] - how do I add the 'ID' part?

      Loop

      Go to Record/Request/Page [ Next, Exit after last]

      If ['Global = ID']  - ???

      Set Field ['Mark', '''X'''] - How do I add the '''X'''?

      Else

      Set Field ['Global', 'ID'] -????

      End If

      End Loop

      Perform Find [Restore] Find records when Mark = X

       

      Basically, I am having an issue adding in the second criteria in the various steps.

       

      Any help would be appreciated as I am under a deadline and this is the last thing I need to do.

       

      Thanks!

      ~A :smileyhappy:

        • 1. Re: Need help with a Find Duplicates script ~ Beginner
          philmodjunk
            

          What version of Filemaker are you using? I'm assuming from your questions that your using a fairly recent version of FMP.

           

          The script example you've found appears to be drawn from an older version. With more recent versions of Filemaker, references to fields in scripts have changed from "Fieldname" to "TableName::Fieldname". Since your script example uses just "Fieldname", it won't perfectly match what you see in your version of filemaker pro.

           

          My comments are in italics.

           

          Show All Records

          This works, but you can use Perform Find and specify the ! operater in the ID field to limit your found set to just those records that have a duplicate ID value if you want.

           

          Sort Records [Restore, No Dialog] sort by ID in ascending order

          Go to Record /Request/Page [First]

          Replace field contents [No Dialog, 'Mark', '''']   - This is where it begins to lose me, how do I add the '''' and what does it mean?

          'Mark' is the name of a field, in today's filemaker, you should see tablename::mark, where tablename is the name of the table where you'll find the definition for the field Mark.

          "" is exactly what you see, two quote marks with nothing in between. To add this click the lower specify button, then choose Replace with calculated result and type in the two quote marks.

          Set Field ['global', 'ID'] - how do I add the 'ID' part?

          ID is the name of your ID field. Click the lower specify button. You'll see the same specify calculation dialog box you saw when you clicked the "..calculated result" option earlier. With a recent version of filemaker you want TableName::ID. Select the table which contains the ID field from the upper drop down menu. ID should now appear in the list of fields directly below this menu. Double Click ID to make it appear in the large field at the bottom of the dialog. Click OK.

          Loop

          Go to Record/Request/Page [ Next, Exit after last]

          If ['Global = ID']  - ???

          Follow the steps from the previous Set Field. WHen done, you should see [tablename::Global = Tablename::ID]. Global and ID do not have to be part of the same table.

          Set Field ['Mark', '''X'''] - How do I add the '''X'''?

          Click the lower specify button, type in a capital X and include one set of quotes.

          Else

          Set Field ['Global', 'ID'] -????

          Same as above.

          End If

          End Loop

          Perform Find [Restore] Find records when Mark = X

           

          Hope that Helps.

          • 2. Re: Need help with a Find Duplicates script ~ Beginner
            agprevite
              

            Thank you so much! I have been trying to do this for hours!

            (I think you are right, that was from an older version and I'm using 9)

             

            Thank you for saving the day!  :smileyhappy:

            ~A