Steve S Posted April 12, 2002 Posted April 12, 2002 I have a db that I use to track art and the supplier of the art. I preform a search for all the art that I used last month and wish to send a letter to each of the suppliers of that art. I have made the form letter, but here is the problem. Since I may have used 5 pieces of art from one supplier, there are 5 occurances of that supplier in my form letter layout. I hope that makes sense. How can i weed out the duplicates so it will only print one page for each supplier. sorry if that was confusing
Fitch Posted April 12, 2002 Posted April 12, 2002 For printing your letters, you could put the whole thing on a Sub-summary part, then sort by supplier. That way you can print one of each, no need to find the duplicates. But if you want to find dupes: in Find mode, an exclamation point ("!", without the quotes) in any field will find the duplicates, but then you have to run a looping script to Omit them. However... for future reference, you will be able to manage things much better by breaking the suppliers and art into separate related files. Duplicating your contacts like that as you have just found out is bound to cause problems.
djgogi Posted April 12, 2002 Posted April 12, 2002 quote: Originally posted by Steve S: I have a db that I use to track art and the supplier of the art. I preform a search for all the art that I used last month and wish to send a letter to each of the suppliers of that art. I have made the form letter, but here is the problem. Since I may have used 5 pieces of art from one supplier, there are 5 occurances of that supplier in my form letter layout. I hope that makes sense. How can i weed out the duplicates so it will only print one page for each supplier. sorry if that was confusing Hi there, here's how you can acheive this: create two global fields mySupliersList and globalRecID define relationship "Supliers" from mySupliersList to Supliers and firstRecord as calc Supliers:: RecID from relationship Supliers. define relationship "onlyFirstOne" from globalRecID to RecordID ( if you don't have it than create it now) Create an layout with only one field on it: Supliers::firstRecord Create an script named findFirstOnes code: Freeze Window Set error capture [on] Set Field [globalRecID,""] Find All Go Layout [your one field layout] Copy All records Go To Layout [ layout with filed globalRecID on It] Paste[globalRecID,select] Go to Related record ["onlyFirstOne",show only related records] HTH Dj
Steve S Posted April 12, 2002 Author Posted April 12, 2002 Thanks you two.. especially Fitch, that suggestion about putting it in a sub summary art was just the easy solution I was looking for. DJ's response made me dizzy, so I stuck to yours And by the way, I do have this set up as a relational database, one db for suppliers and one for art. I dont have duplicate records for my suppliers, I have many art records linked to one supplier record... So when I do a search on the art, I get multiple hits on the same supplier record. But thanks alot, after fussing with it for some time I got it working the way I want. Now I find I have a smiliar problem with my labels.. I want to do the same thing, but with labels instead of a form letter.. I've been fussing with sub summary parts, but cannot quite get it right. Maybe I have to get dizzy... [ April 12, 2002, 06:48 AM: Message edited by: Steve S ]
Fitch Posted April 12, 2002 Posted April 12, 2002 Re: your labels, first just use one of the pre-set label layouts, then double-click on the body part and change it to a sub-summary. However, now that we have the whole story, I think you should try something along the lines of dj's solution. It's really not too tricky. 1. In your art file, create a global text field, let's call it gArt. Put this field on a layout somewhere, or make a layout to put it on. 2. Create a relationship to your suppliers file, gArt::supplier id. We'll name this relationship... suppliers. 3. Make a layout (we're still in the art file) that has ONLY the supplier id field on it. 4. Now make a script: . Go to layout (supplier id). . Copy all records. . Go to layout (with gArt on it). . Paste into gArt. . Go to related records (suppliers, show only related). Basically the same script dj already posted. Possibly the confusing part was the self-relation, I don't know. But that isn't the case here -- you already have two related files.
Recommended Posts
This topic is 8263 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