13 Replies Latest reply on Jan 7, 2009 10:38 AM by ninja

    Button script

    trunkp

      Title

      Button script

      Post

      I have an script for a button that asks the button to:

       

      1. Go to layout

      2. Go to Record/Request/Page(2312)

       

      I set the calculation to the correct record number and when I click the button I get this:  Go to request 2312 out of 1.  It should say Go to request 2312 out of 2675.

       

      I am a new user and I apprecite any help you can offer.

       

      Trunkp

       

        • 1. Re: Button script
          ninja
            

          Good morning trunkp,

           

          Thanks for the post.

           

          I just recreated what you are seeing.  You are launching the "Go to Record/Request Page(2312)" from inside a found set.

           

          Add a line to your script:

          1. Go to layout

          2. Show all records

          3. Go to Record/Request Page(2312)

           

          Should work out perfectly for you.

           

          Enjoy the day! 

          • 2. Re: Button script
            Orlando
              

            Hi Trunkp

             

            Teh dialog that pops up is it titled 'Specify Number'? If so, when you specify the script step Go To Record/Request/Page [2312] click the check box 'Perform without dialog', bottom left by where you specify the record number, this will stop the dialog from displaying.

             

            Also when it says "2312 out or 1" when you run the script, are you in a found set of 1 record? If you must always go to a particular record using the record number may not be reliable if a record before it is deleted. 

             

            A better solutions would be to search on a UniqueID for that record.

             

              #

              Enter Find Mode []

              Set Field [ UniqueID ; 2312 ]

              Perform Find []

              #

             

            I hope this helps 

            • 3. Re: Button script
              trunkp
                

              Actually I gave false information to my previous post. Here is my problem....

               

              I have 2 files. One is a layout for lesson plans. The other is a list of teaching standards for various subjects.  All the standards are seperate records. There are 2600 of them.  What I want to do is create a button that says "science" and have it open the other file and go directly to the science standards so that my teachers do not have to scroll through all 2600 standards to fine the one they want. The script I have for the "science" button reads as follows:

               

              Open File [SSS].....(SSS stands for Sunshine State Standards and is the name of the other file)

              Go to Record/Request/Page [2123]

               

              The problem I have is when I click on the science button it open to the correct file but the dialog box says says "Record 2123 out of 1"  It needs to say 2123 out of 2600. Thanks for anyhelp you can offer.

               

              trunkp

               

               

              • 4. Re: Button script
                ninja
                  

                Good morning trunkp,

                 

                Thanks for the additional info.

                 

                As both Orlando and I have mentioned earlier in the thread, you're probably getting the "2123 of 1" dialog because you are starting within a found set.  If you want to use this approach of going to a record number, add one step to your script:

                 

                Open File [SSS]

                Show All Records

                Go to Record/Request/Page [2123]

                 

                The "Show all records" part will give you the "Record 2123 of 2600" dialog you seek.

                If you want to avoid the dialog altogether, check the "Perform without dialog" box in scriptmaker.

                 

                I would also second Orlando's caution to you...going to a record number is a potentially dangerous way to point to a record.  If anyone ever resorts your records, or deletes any, your script will end up pointing to the wrong place.

                It would be safer and more robust to create a "topic" field within your standards table, and set it to "Science" for the record you want (ie. record 2123).

                When someone cllicks on the science button, the script would then perform a "Find" for [Standards::topic="science"] Instead of a Go To Record.  This would be a safer and more lasting way to accomplish what I think you are after.

                • 5. Re: Button script
                  trunkp
                    

                  I have tried what you suggested "show all records" as part of the script and it still only shows record 2123 out of 1 in the dialog box.  I understand you suggestion of not using "go to record/request/page" but no one will be changing the records or standards. I am puzzled why this is not working.

                   

                  How about

                   

                  1. "Go to file [SSS]"

                  and then "go to layout" command within that file SSS. The layout is called SSSa. That is the layout of the standards within the SSS file.  I happen to have 2 layouts within that file.

                  • 6. Re: Button script
                    ninja
                      

                    Good call trunkp,

                     

                    You would have to be on the layout associated with "Standards" before doing the "Show All Records".

                     

                    "Show All Records" will expand the found set to all records in the active table (2600 in your case).

                     

                    Sorry that I left that part out.  Thanks for catching it and recognizing it.

                     

                    • 7. Re: Button script
                      trunkp
                        

                      So here is my script..

                       

                      1. Open File [sssa]

                      2. Go to layout [original layout]   here is the problem..I think...when it asks me to "specify" the layout, SSS layout is not a choice.

                      3. Show all Records

                      4. Go to record/request/page [2123].

                       

                      I am thinking I may have to combine the 2 files and that way...I think...I will then have access to the layout I need within the first file.

                       

                      trunkp

                       

                       

                      • 8. Re: Button script
                        ninja
                          

                        trunkp,

                         

                        OK, lets regroup for a second.

                         

                        Is this "Science" record the only one anyone ever references through this database?  If so...there are far easier ways to do this.

                         

                        • 9. Re: Button script
                          trunkp
                            

                          No, I was going to create a button for all subject areas so all the teachers had to do was click the button and it would take them directly to their subject area standards. The standards are in one file and the lesson plan template is another file.  I can get to the standards file from the lesson plan template. I just cannot get the dialog box to say "go to record 2132 out of 2600". Instead it says "go to record 2132 out of 1".

                          Sorry if I did not make that clearer.

                           

                          trunkp

                          • 10. Re: Button script
                            ninja
                              

                            Ahhhhh,

                             

                            I finally understand.  You have two different and unrelated files, they need to be related somehow in order for you to hop to the other file's layouts...simple enough to do.

                             

                            Lets work on this offline...I've sent you a PMessage.  Sorry it took me so long to understand.

                            • 11. Re: Button script
                              trunkp
                                

                              Okay...what is a pmessage?

                               

                              trunkp

                              • 12. Re: Button script
                                ninja
                                  

                                Trunkp,

                                 

                                I've sent you a private message.  Look toward the top right of the screen on the grey bar.  It should show that you have a message.

                                 

                                 

                                • 13. Re: Button script
                                  ninja
                                       From PrivateMessage:

                                  Ninja.

                                  1.  I have 2 seperate databases. One called lesson plans and the other is called SSSa.

                                  2. I am using ver. 9.0

                                  3.  I believe there is no relationship between the two.  

                                  +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

                                  trunkp...there's your problem...I should have asked before...sorry for taking so long to ask the right question...

                                   

                                  Step 1: create a field in Lesson Plans called "Link Topic"

                                  Step 2: create a field in SSSA called "Link Topic"

                                  Step 3: In SSSA, fill this field as appropriate to the record: Science, Math, etc...

                                  Step 4: In Lesson Plans, under 'File>define database', form a relationship between "LessonPlans::Link Topic" and "SSSA::LinkTopic".  FMP help screens will walk you through this if needed.

                                  Step 5: revisit your script, scrap it and start the script over... (1) SetField[LessonPlans::LinkTopic="science"]...then (2) GotoRelatedRecord in SSSA using the layout from SSSA {Use external table's layouts}.

                                  Step 6: for every button you want to add...use the same or similar script, just replace Setfield=science with Setfield=math or Setfield=biology, etc.

                                   

                                  Run with it...you're almost home...