Re: Sequential printed labels
Re: Sequential printed labels
Source: http://newsgroups.derkeiler.com/Archive/Comp/comp.databases.filemaker/2006−08/msg00381.html
• From: "B. Monse" • Date: 7 Aug 2006 17:42:44 −0700 Thanks for your help. I'll give it a try but I bet I'll be back...
Marc−André Paiement wrote: B. Monse a écrit : I'm trying to use an ancient FileMaker installation on the ~10 year old PC in my office to create incremental barcoded labels for musical scores in a public school music library. Each title is one record, with a field specifying the number of copies owned. I have set up a layout for Avery labels, and would like to create labels for each score, but with each label repeating with an incremental number to the total number of copies. (So if we have 24 copies the labels will print XXXXXXX01, XXXXXXX02 etc to 24) I am new to the scripting capabilities and am not sure how to go about doing this without making a separate record for each individual copy!
Actually, that's exactly what I would do :). I would set up a separate file where these records would be created by a script (and deleted as soon as the printing is done). The idea is to be able to print the whole set without having to send a separate print command for each repetition of the same "record" (no 1 of 24, no 2 of 24, etc.). Otherwise, each successive print will start over at the top of a new sheet. If it weren't for the incremental number, you could just print the required number of labels for each record and be done, but since you really need 24 different labels for a single record (for isntance), it's either 24 successive print commands (with a script modifying the incremental number between each print command) or a single print command for 24 different records. Obviously, in the case of labels, only the second method is possible. There are 2 techniques that you need to learn in order to use that method. The first one allows to pass data between 2 files trough a "constant relationship" while the second one is a "looping script" where Re: Sequential printed labels 1
Re: Sequential printed labels we increment a counter at each iteration, so that we can control the number of records that will be created in the printing file. I suppose your databse contains fields for composer, title of work, number of copies, other things such as publisher or comments, and a reference number (maybe an auto−entered serial number) that you want to use as the basis for the barcode. First you will need to create some new fields: − "constant", a calculation field that simply return the number 1. (Make sure to specify the result of the calculation as of type number) − "g_ref_number", a global field of type text − "g_nb_copies", another global field of type number. − "g_counter", another global field of type number. None of these fields need to appear on any layout, btw. Next, you need to create your printing file, defining just two fields : − "barcode", of type text. − "constant", same as in the main databse. Obvisouly, you will also need to recreate your printing layout in this file. In the printing file, you can now establish a relationship to the main file (under the File menu −> Define relationship). Let's call this relationship "constant" and use the constant field as the match field on both sides. Back in the main file, we can now create a script that loops through the found set (the records you want to print). For each record, the script will put the Nb of copies in the "g_nb_copies" field, put your Ref_number in the global field "g_ref_number" (along with the number of that particular copy), and then calls a sub−script (in the printing file) to create a corresponding record. The trick is to call that sub−script as many times as required, incrementing our counter at each pass, till it equals the total umber of copies So: go to record (first) loop set field (g_counter, 1) set field (g_nb_copies, nb_of_copies) loop set field (g_ref_number, ref_number & right("0" & g_counter, 2)) perform sub_script (external, "create record" in the printing file) set field (g_counter, g_counter + 1) exit loop if (g_counter > g_nb_copies) end loop go to record (next, exit after last) end loop In the printing file, we also need the script "create record" (the one that's called in the innter loop of the first script): Re: Sequential printed labels 2
Re: Sequential printed labels New record/request set field (barcode, constant relationship:: g_ref_number) which means that, in the "specify" dialog box that appears when you click on the "specify" button for the set field step, you have to select the constant relationship at the top left of the box and then the g_ref_number field (we're getting that field's content trough the constant relationship) This, as well as many others such details, may not be immediately obvious if you're just starting with scripts, relationships, defining calculation or global fields... So don't hesitate to post again if you try this and run into problems. Good luck! Marc−André Paiement
If it is possible I would also like to be able to select more than one Re: Sequential printed labels 3
Re: Sequential printed labels title and use all the labels on a page as needed − so that on a page of 80 labels I could print 50 for one score and then use the last 30 for the next score, etc. Any advice for a FMP amateur?
.
Re: Sequential printed labels
4