1 2 Previous Next 20 Replies Latest reply on Jul 19, 2010 1:41 PM by FileBreakerPro

    Please help, Printing Scripts with a twist

    FileBreakerPro

      Title

      Please help, Printing Scripts with a twist

      Post

      I have a really hard time with scripts. i need a script for printing. here is the whole issue, thanks in advance:

      i am creating this database for someone else but we will call this the Cookie Database :-)

      One layout is: Cookie Recipes. Multiple records of different kinds of cookie and their recipes.

      One layout is: Personal Records, in this layout is a list of Checkboxes of the different kinds of cookies in the Cookie Recipes Layout. I will check which types of cookies this person likes.

      The script I need help with is: that when I print this person's record, it also prints the different cookie recipes from the Cookie Recipes Layout *BASED* on the selected checkboxes.

      ex: if Jane likes sugar cookies and chocolate chip cookies and gingerbread cookies, i will check the appropriate checkboxes in her record. when i print her record, the recipes for sugar cookies, chocolate chip, and gingerbread cookies will also print. i can then send her the recipes in the mail, for her to make and enjoy :-) Is everyone now as hungry as I am?!?

      thanks for any insight and help! 

        • 1. Re: Please help, Printing Scripts with a twist
          philmodjunk

          You can do this more easily with the script step Go To Related Records than you can with scripting a find though that can also be done.

          Create a relationship between the two tables on which your layouts are based. You may need to create a second table occurrence of Cookie Recipes if you already have a relationship linking the two. (To create the second TO, click Cookie Recipies in Manage Database | Relationships and then click the button with two plus signs.)

          Personal Records::CheckBoxField = Cookie Recipes::CookieType

          Now the script step: Go TO Related Recipes can be used to bring up all the cookie recipes on the cookie recipe layout for any cookie types selected in the checkboxfield.

          The catch here is you need to check first to see if their are any matching recipe records before performing the Go To Related Records step or you could end up printing from the wrong layout.

          For more information on Go To Related Records, see this thread: The Complete Go To Related Record

          • 2. Re: Please help, Printing Scripts with a twist
            FileBreakerPro

            good idea. im just trying to save myself a couple steps. i have done related records scripts before but not to print. can i go to related records then put something in the script to automatically print? there will only be one record/recipe for each cookie type. so when i go to the related records, it should only bring up one of each cookie type recipe. was this the catch you mentioned?

            • 3. Re: Please help, Printing Scripts with a twist
              philmodjunk

              The caution, as documented in the link I provided, is that bad things can happen if there are no related records and you use GTRR anyway. There's a Print script step you can use to print your records.

              The script outline is this:

              1. If [ not IsEmpty ( cookie Recipies::IDfield ) /* Check for related records */]
              2. Go To related records....
              3. Sort
              4. Print
              5. Return to original layout
              • 4. Re: Please help, Printing Scripts with a twist
                FileBreakerPro

                ok ill check it out. thanks. any others have imput?

                • 5. Re: Please help, Printing Scripts with a twist
                  FileBreakerPro

                  one problem i am coming up with is that there are too many related records to open and print them all. one personal record could have many different cookie types checked. knowing this database i am creating, this will be an issue. it would be great to have them just filter behind the scenes. i dont want to open the related records (cookie recipes) and have to go thru and verify they are all the right recipes and then print.

                  • 6. Re: Please help, Printing Scripts with a twist
                    philmodjunk

                    What criteria establishes that they are the "right recipes"? If there are "too many" matching records, you'll need to use some kind of criteria to establish which records are the desired ones. Once you know that and can include it in the script, you can set the whole process to run while freeze window keeps anything from showing until the process is done.

                    But I have no idea from your posts how to take the list of records that match the specific values in the check box field and reduce the list to a smaller found set as you haven't yet indicated what rules would determine which records to keep and which to exclude from this set.

                    Your script could probably follow up with a constrain found set operation to reduce the set of matching records, but I don't know enough about your set to know for sure.

                    • 7. Re: Please help, Printing Scripts with a twist
                      FileBreakerPro

                      the desired/"right" recipes are the ones checked in the check box field. there will not be "too many" records as to say: too many records match, but rather: this person likes too many cookies :-). there will be many records because the personal record will have multiple check boxes checked.

                      • 8. Re: Please help, Printing Scripts with a twist
                        philmodjunk

                        "the desired/"right" recipes are the ones checked in the check box field."

                        Then how are you getting "too many"? The only records that should be found when Go To Related records does its thing are only those that match one of the values selected in the check box field.

                        • 9. Re: Please help, Printing Scripts with a twist
                          FileBreakerPro

                          not that there are too many, just that i felt that it was too many records the open with the GTRR script then have to look the list of them. for example: a person likes 25 different cookies; i wouldnt want to open 25 recipes and look thru them all. i think it wont be a problem. but i really am horrible with scripts. i dont even know where to start with this one. 

                          • 10. Re: Please help, Printing Scripts with a twist
                            FileBreakerPro

                            i am trying the GTRR script that you specified: Now the script step: Go TO Related Recipes can be used to bring up all the cookie recipes on the cookie recipe layout for any cookie types selected in the checkboxfield. 

                            nothing is happening, the relationships and there are check boxes checked and recipe records have been created but nothing is happening when i try to run the script. would there be a part of the script were i had to specify to look for related records from the check box field?

                            • 11. Re: Please help, Printing Scripts with a twist
                              philmodjunk

                              OK, but I don't know what you want to do when the system pops up "25 different cookie recipes". This is doing what I understood from your original post, that you wanted. I don't know what you want to happen differently in this situation. How would you want such a list of records reduced so that you "don't have to look through them all"?

                              Do you instead want to see just one of selected types?

                              Would you like to see a list of the matching recipes that only lists the titles so that you can more easily scroll through them to select one for viewing in detail?

                              • 12. Re: Please help, Printing Scripts with a twist
                                FileBreakerPro

                                i could view as: List View then i could just scan over the recipes quickly. ideally, the related recipes stay hidden and just print. it would be nice not to have to look thru them at all. although the list view would be the next best idea.

                                • 13. Re: Please help, Printing Scripts with a twist
                                  philmodjunk

                                  Your script can start with Freeze Window, use GTRR to find the records, use a Print Script step to print them and then Go To Layout [Original Layout] to return to the original layout.

                                  • 14. Re: Please help, Printing Scripts with a twist
                                    FileBreakerPro

                                    ok that sounds like it will work.

                                    NEVERMIND BELOW: i had found a glitch i had accidentely added in the Relationship

                                    but back to starting the GTRR script- i am trying the GTRR script that you specified: Now the script step: Go TO Related Recipes can be used to bring up all the cookie recipes on the cookie recipe layout for any cookie types selected in the checkboxfield. 

                                    nothing is happening, the relationships and there are check boxes checked and recipe records have been created but nothing is happening when i try to run the script. would there be a part of the script were i had to specify to look for related records from the check box field?

                                    1 2 Previous Next