Shar Posted March 19, 2008 Share Posted March 19, 2008 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. Quote Link to comment Share on other sites More sharing options...
AHunter3 Posted March 19, 2008 Share Posted March 19, 2008 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. Quote Link to comment Share on other sites More sharing options...
Shar Posted March 20, 2008 Author Share Posted March 20, 2008 I just want the duplicate records omitted from printing labels or envelopes. Quote Link to comment Share on other sites More sharing options...
Shar Posted March 20, 2008 Author Share Posted March 20, 2008 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. Quote Link to comment Share on other sites More sharing options...
AHunter3 Posted March 20, 2008 Share Posted March 20, 2008 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. Quote Link to comment Share on other sites More sharing options...
Shar Posted March 20, 2008 Author Share Posted March 20, 2008 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. Quote Link to comment Share on other sites More sharing options...
the magician Posted November 13, 2008 Share Posted November 13, 2008 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. Quote Link to comment Share on other sites More sharing options...
AHunter3 Posted November 13, 2008 Share Posted November 13, 2008 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. Quote Link to comment Share on other sites More sharing options...
the magician Posted November 13, 2008 Share Posted November 13, 2008 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. Quote Link to comment Share on other sites More sharing options...
the magician Posted November 13, 2008 Share Posted November 13, 2008 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. Quote Link to comment Share on other sites More sharing options...
AHunter3 Posted November 13, 2008 Share Posted November 13, 2008 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. Quote Link to comment Share on other sites More sharing options...
the magician Posted November 13, 2008 Share Posted November 13, 2008 Thanks for you help. I think I have it now. Will test, and if not, I'll be back tomorrow! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.