Addam Posted May 25, 2001 Posted May 25, 2001 I need to print different layouts based upon a fields content... IE: (field=green) print "Green" layout, (field=blue) print "Blue" layout...etc. I tried using different "If/Then" statements, but I seem to be missing something. It keeps all records in 1 view!?!??!?! CAN YOU PLEASE HELP ME! I'm having a hell of a time trying to figure this out! [ May 25, 2001: Message edited by: Addam ]
JPaul Posted May 25, 2001 Posted May 25, 2001 Hi Addam, you have almost two ways to solve this, instead use 'if ... else' statement: - use the subsummary sections in your report - print a portal with a relation issued on the color field. Hope this helps. Greetings from Holy Lands.
Newbies Johan Posted May 29, 2001 Newbies Posted May 29, 2001 quote: Originally posted by Addam: I tried using different "If/Then" statements, but I seem to be missing something. It keeps all records in 1 view!?!??!?! From what I understand, the first paper you print shows all the records and you only want it to print the current record? If you only want to print one record, you do this by selecting Print This Record when printing and not Print Current Records.
Gogargirl Posted May 29, 2001 Posted May 29, 2001 A simple thing that often catches me out on this type of thing is remembering to check that that the field is correctly defined to give the right answer. i.e. if Field is a number field, you won't get the right result with "green" and "blue" in text. Good luck!
bobsmith Posted May 30, 2001 Posted May 30, 2001 Since I had the same problem, I think I know what you are trying to do. If I am right you want to switch between layouts while printing. This can not be done. I wanted to print a document where the first section was on one layout and the second on another etc, I had to set up different scripts to print the first section then do another find and print the second on a new layout etc. This worked for me since there were many records in each section that did not require switching layouts, but if you have to switch often such as record 1-4 layout 1; 5-10 layout 2, 11-12 layout 3 and so on this method will probably not work.
stephiesmith Posted May 31, 2001 Posted May 31, 2001 Addam, Perhaps I misunderstood since I do believe I've done what you're asking. Try setting your script up as I've done below. It will only work for you if you are using the same paper in your printer for all layouts because it will go to the first record, check the field contents, go to the appropriate layout and print. Then it will go to the next record, check the field, etc. As long as you check the box "perform without dialog" for the print step, it will go through automatically and print them all. Make sure you have as many End Ifs as you do Ifs. Stephie ======== Loop If[field=green] Go to Layout [green layout] Else If[field=blue] Go to layout [blue layout] Else If[field=red] Go to layout [red layout] End If End If End If Print End Loop
bobsmith Posted May 31, 2001 Posted May 31, 2001 My bad. I was printing to a pdf file to create a catalog, if you are printing to a printer I think Stephie's script will work.
bobsmith Posted May 31, 2001 Posted May 31, 2001 My bad. I was printing to a pdf file to create a catalog, if you are printing to a printer I think Stephie's script will work.
stephiesmith Posted May 31, 2001 Posted May 31, 2001 Addam, I forgot to mention that you should do your FIND or put the PERFORM FIND step in the script before the loop starts because the looping script will work on the found set. So, it expects each record in the found set to meet one of the 3 color criteria and be printed. (I'm not advanced enough to tell you what to do if it gets to a record where field=yellow!!) Stephie
JPaul Posted May 31, 2001 Posted May 31, 2001 To Stephie: and when and which way do you exit from loop ? (In this case looping is unnecessary) I repeat the concepts: partially summarize by colour (if do you want to print records) use a portal to show your recs. with a relation based on colours use 'goto related ....' statement to show / print all colour-related records, and that' s all. Have nice job. [ May 31, 2001: Message edited by: JPaul ]
stephiesmith Posted May 31, 2001 Posted May 31, 2001 Sorry, I wrote that from memory, but when I checked my actual script, the exiting is: END IF PRINT [Exit After Last, Next] END LOOP
JPaul Posted May 31, 2001 Posted May 31, 2001 quote: Originally posted by Stephie Smith: Sorry, I wrote that from memory, but when I checked my actual script, the exiting is: END IF PRINT [Exit After Last, Next] END LOOP You also have forgotten to navigate trhu records (or fields, ahi); the result of your script may produce a bad side-effect: high speed changing forms (as the colour found in the proper field does change !). Perform your script in the reality and see effects, then apply one of the tecniques i suggested and see what different happens. The trick is to group each set of colour-related records. Stay in touch and greetings from Holy Lands.
stephiesmith Posted May 31, 2001 Posted May 31, 2001 JPaul, I use this script all the time and it works great. I have a restored find that finds the records that I want to print at the beginning of the script before the looping starts. It takes only seconds for the script to work and I've never had a problem with it. I don't know what else to say.
JPaul Posted May 31, 2001 Posted May 31, 2001 quote: Originally posted by Stephie Smith: JPaul, I use this script all the time and it works great. I have a restored find that finds the records that I want to print at the beginning of the script before the looping starts. It takes only seconds for the script to work and I've never had a problem with it. I don't know what else to say. Sorry and not to be polemic, but if you perform a find before the loop the only effect you achieve is to print a report for each record your loop encounters (buying paper is very expensive ....) If you issue a colour-based find, the loop is unnecessary because you are right in the proper found set, then why testing the colour field of each record ?? !! May your real working script differs from what you have figured here. Regards.
stephiesmith Posted May 31, 2001 Posted May 31, 2001 JPaul, I am not printing reports. I am printing a letter for each record, depending on the record info (3 different possible text layouts). I thought that Addam was trying to do something similar. He never mentioned that he was trying to print reports. He said he wanted to check a certain field for info and based on that info, go to a particular layout and print. Maybe I am wrong about what he is trying to do, and if so, he won't be interested in my tip. My "FIND" that is restored before the looping starts is simply a "Print" checkbox that is automatically checked "YES" for new records. At the end of my script, I have a subscript that goes through and removes those checks.
Addam Posted June 1, 2001 Author Posted June 1, 2001 THANK YOU ALL FOR YOUR COMMENTS!!! JPaul, Your suggestion actually helped me with a problem that I had this morning and Stephanie, You did solve my problem!! THANK YOU SOOOOOO MUCH!! NEXT ROUND OF DRINKS ARE ON ME! ~Addam~
Addam Posted June 1, 2001 Author Posted June 1, 2001 To all who read this, Here is the scrip step that worked: print loops Go to Record/Request/Page [ First ] Loop If [ Move Color = "Black" ] Go to Layout [ Black ] Else If [ Move Color = "Yellow" ] Go to Layout [ Yellow ] Else If [ Move Color = "Blue" ] Go to Layout [ Blue ] Else If [ Move Color = "Orange" ] Go to Layout [ Orange ] End If End If End If End If Print Go to Record/Request/Page [ Next, Exit after last ] End Loop
JPaul Posted June 1, 2001 Posted June 1, 2001 Hello Addam, finally the job does go ahead ! Very happy for you. Best regards & have nice job.
Recommended Posts
This topic is 8580 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