May 25, 200124 yr 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 ]
May 25, 200124 yr 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.
May 29, 200124 yr Newbies 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.
May 29, 200124 yr 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!
May 30, 200124 yr 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.
May 31, 200124 yr 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
May 31, 200124 yr 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.
May 31, 200124 yr 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.
May 31, 200124 yr 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
May 31, 200124 yr 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 ]
May 31, 200124 yr 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
May 31, 200124 yr 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.
May 31, 200124 yr 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.
May 31, 200124 yr 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.
May 31, 200124 yr 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.
June 1, 200124 yr Author 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~
June 1, 200124 yr Author 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
June 1, 200124 yr Hello Addam, finally the job does go ahead ! Very happy for you. Best regards & have nice job.
Create an account or sign in to comment