Jump to content
Salesforce and other SMB Solutions are coming soon. ×

FM 5.5 script for omitting duplicates


Shar

Recommended Posts

Does anyone have a script for omitting duplicate names to print mailing labels? We have a database of about 2000 building permits and want to send letters to builders but many of these are duplicates. I created a calculation field that combines Last name and first name. Since I don't know a lot about scripts except very basic, nothing I have tried has worked.

 

Any help would be greatly appreciated.

Link to comment
Share on other sites

You want them DELETED or OMITTED? If you're deleting, make a backup FIRST lest things go awry. Omitting is safe though.

 

Create a global text field, g.Text

 

Before printing, sort by the field (name? full name?). Go to first record. Then loop:

 

.. Set Field [g.Text, ""]

Loop

..If [Full Name = g.Text]

.... Omit Record

.. Else

.... Set Field [g.Text, Full Name]

.... Go to Record [Next]

.. End If

.. Exit Loop If [status(CurrentFoundCount) = Status(CurrentRecordNumber) and g.Text≠Full Name]

End Loop

 

That's off the top of my head but barring a slip of the brain on my part that should do it.

 

Then you can print and should get one printout per name only.

Link to comment
Share on other sites

AHunter3,

 

I set up the script but in the

 

Exit Loop If [status(CurrentFoundCount) = Status(CurrentRecordNumber) and g.Text≠Full Name]

 

it would not accept g.Text#IndexName. Message was "gText#Index Name" not found.

 

I set up a gText global field and already had Index Name.

 

Do you know what I am doing wrong? Thanks you so much for your help.

Link to comment
Share on other sites

Look closer. What I wrote was g.Text ≠ Full Name.

 

What you wrote, and what you may have entered into FileMaker, was gText # Index Name. That's a number sign not a doesnt-equals sign.

 

If you are on a Windows PC, you may not actually have ≠ (for us Mac folk it's option-equals). If that is the case, FileMaker understands to mean the same thing.

Link to comment
Share on other sites

Thank you so much, I will try that. I am in a Windows environment. Really appreciate the information. Won't be able to work on it for a couple days because of other job. Again thanks. Will let you know if I get it.

Link to comment
Share on other sites

  • 7 months later...

Hi, and thanks for your help. I'm a FMP newbie, but familiar with VB and VBA, and programming in general, so still learning how to make FMP work for me. A question:

How do you create a global text field?

 

You want them DELETED or OMITTED? If you're deleting, make a backup FIRST lest things go awry. Omitting is safe though.

 

Create a global text field, g.Text

 

Before printing, sort by the field (name? full name?). Go to first record. Then loop:

 

.. Set Field [g.Text, ""]

Loop

..If [Full Name = g.Text]

.... Omit Record

.. Else

.... Set Field [g.Text, Full Name]

.... Go to Record [Next]

.. End If

.. Exit Loop If [status(CurrentFoundCount) = Status(CurrentRecordNumber) and g.Text≠Full Name]

End Loop

 

That's off the top of my head but barring a slip of the brain on my part that should do it.

 

Then you can print and should get one printout per name only.

Link to comment
Share on other sites

In Filemaker any-version-between-3-and-6:

 

Field Definitions --> Define new field, type "Global", subtype "text".

 

filemaker_define_fields_dialog.gif

 

See the radio button option for "global". Once you pick that, give field a name and hit the Create button, you'll see a place where you can specify "text","Number", "Date", etc as the type of global. It should default to text already.

Link to comment
Share on other sites

Got it, thanks. Next thing in the script I can't seem to do:

Sort[Table::Field,ascending, no dialog]

I don't see how to add identifiers to the brackets. Options are "Restore sort order" and "no dialog". Is that post-5.5?

 

In Filemaker any-version-between-3-and-6:

 

Field Definitions --> Define new field, type "Global", subtype "text".

 

See the radio button option for "global". Once you pick that, give field a name and hit the Create button, you'll see a place where you can specify "text","Number", "Date", etc as the type of global. It should default to text already.

Link to comment
Share on other sites

By the way, the script I found (apparently in a later version forum here) is this:

Show All Records <---
Sort [YourTable::YourField, ascending, no dialog]
Go to Record [First]
Set Variable [$Value, YourTable::YourField]
Go to Record/Request [Next, Exit After Last]
Loop
..If [ YourTable::YourField = $Value ]
....Delete Record/Request (no dialog)
..Else
....Set Variable [$Value, YourTable::YourField]
....Go to Record/Request [Next, Exit After Last]
..EndIf
End Loop

 

I guess I'm trying to duplicate it in 5.5-speak. thanks.

Link to comment
Share on other sites

Got it, thanks. Next thing in the script I can't seem to do:

Sort[Table::Field,ascending, no dialog]

I don't see how to add identifiers to the brackets. Options are "Restore sort order" and "no dialog". Is that post-5.5?

 

My fault. In pre-FileMaker 7, you can't specify what to sort BY right there in the script. You have to sort MANUALLY first, sorting by the correct fields and by ascending or descending, etc... THEN you go back into your script and insert a script step that simply says Sort [restore sort order, no dialog].

 

When you OK the script say YES to replacing any previously saved sort order.

Link to comment
Share on other sites

This thread is quite old. Please start a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

Terms of Use