1 2 Previous Next 15 Replies Latest reply on Feb 24, 2012 8:24 PM by liza

    Script to go back to original layout AND original record

    liza

      I have a script which goes to a different layout, but I want it to go back to the original layout and record by the end of the script. I can't figure out how to make it go back to the original record though. Sometimes it's correct, but sometimes it goes to a different record. Is there any calculation or script step to ensure this?

        • 1. Re: Script to go back to original layout AND original record
          ariley

          You'll need to record the ID or the record number of the original record to a variable so your script can find its way back. 

           

          Then you use the Go to record script step, choose by calculation from the drop-down menu and feed it the variable you defined in the beginning of the script. 

           

          Regards,

           

          Agnes Riley

          FileMaker 10 and 11 Certified Developer

           

          http://www.zerobluetech.com

          C 917 660-7221

          T 201-293-5828

           

          Member, FileMaker Business Alliance

          Member, FileMaker Technical Network

          • 2. Re: Script to go back to original layout AND original record
            BruceRobertson

            The best thing would probably be to post a copy of your script. There is no script step for go to record ID; and if the data has been sorted or record has been omitted or you have a different found set, that will make a difference for a go to record number step.

             

            It is usually better to supply a fair amount of detail (such as a copy of a script, or description at least) when posting a question.

            • 3. Re: Script to go back to original layout AND original record
              BruceHerbach

              Hi Liza,

               

              One way to do this is to have the first script Goto related record in a new window.  Then when you are ready to go back just close the window.  This should put you back in the first window same record.

               

              HTH

              Bruce

              • 4. Re: Script to go back to original layout AND original record
                ariley

                Mr. Robertson is right: you cannot go to a script based on an ID. But you can "highlight" a record based on an id. And once that record is selected, that is your record where you came from. This might be a bit complicated to explain in a one-liner.

                 

                It really helps if you post your script and environment for these types of questions (OS, FileMaker version, etc.), because scripts behave differently in different environments. 

                 

                Regards,

                 

                Agnes Riley

                FileMaker 10 and 11 Certified Developer

                 

                http://www.zerobluetech.com

                C 917 660-7221

                T 201-293-5828

                 

                Member, FileMaker Business Alliance

                Member, FileMaker Technical Network

                • 5. Re: Script to go back to original layout AND original record
                  liza

                  Hi Everyone, thanks for the replies. Attaching here a screenshot of the script (there are 2 lines cut on top, which is "Commit records" and "Set Variable"). To explain the script, I'm in the "Sale" layout where I will be encoding sales data on the portal "AdjustmentQty". I click this script to bring up the item list (filtered by the particular location) and encode the sale quantities. The quantities are then transferred to the layout "AdjustmentQty", and it goes back to the "Sale" layout where I'm supposed to see the data. This is where the problem is, when it goes back, it sometimes goes to a different record other than the record where I originated.

                   

                  I can also probably try Mr. BruceHerbach's suggestion, but for some layouts, I would prefer that there is just one window for the user work on.

                   

                  I'm using FilemakerPro 11, OS Snow Leopard.

                   

                  Thanks a lot,

                  Liza

                   

                  Screen shot 2012-02-23 at 2.45.07 PM.png

                  • 6. Re: Script to go back to original layout AND original record
                    timwhisenant

                    Hi Liza,

                    Pratically, there is an invoice number, right?

                    Why not set the invoice number to a variable, when you are ready to return to it script a find using the variable you set at the beginning?

                    I assume you have a system in place to prevent duplicate invoice numbers( a needed accounting control).

                     

                    Hope this Helps,

                    Tim

                    • 7. Re: Script to go back to original layout AND original record
                      ariley

                      Ok, Lisa, the best way to handle this is to open a new window. But the users don't need to see it and once you made sure your script does what you need it to do you don't need to see it either.

                       

                      So, here's how you do that:

                       

                      1. Create a custom function called NegativeSpace and give it a value of "//-10000". That will crate but disable the function for now.

                      2. Tell your script to open a new window, name your window the layout where you're going to and set the from top and left values to the "NegativeSpace". At the end of the task you're performing, tell your script to close the aforementioned window.

                      3. Test your script in debugger. You'll see it'll open the window and perform the task and close the window.

                      4. Once you're satisfied with the result, remove the "//" from your custom function and you'll see the script will run without a hickuo and nobody will see the windo was ever there.

                       

                      I use this a lot. Hope it helps you.

                       

                      Agi

                       

                       

                       

                      Sent from my iPad

                      • 8. Re: Script to go back to original layout AND original record
                        Stephen Huston

                        Hi Liza,

                         

                        IMHO, Agi's solution is the best in the list so far, and I would add a couple of mentions to make it safer and more foolproof:

                        1. When you have opened the second window, rename it t something very specific so you can safely close that window by name regardless of where you are later in the script.
                        2. Place a Allow User Abort (OFF) step before opening the new window and make sure user abort stays off until the new window is closed by name.

                        These will make sure the temporary window doesn't get left open for the user to work in, or, worse yet, call other scripts which may select specific windows and get this one by accident if it has a default name.

                         

                        Stephen Huston

                        • 9. Re: Script to go back to original layout AND original record
                          deninger

                          I like this idea. I will have to file it away as yet another tool in by toolbox.

                          • 10. Re: Script to go back to original layout AND original record
                            liza

                            Hi Agi,

                             

                            I'm not using Filemaker Pro Advanced, so I don't think I can create a custom function? However, I tried out Mr. Herbach's original suggestion and your suggestion as well to open a new window, and it seems to work out well for my purpose, even if the window can be seen. Thanks so much, this helps a lot, and I can use it for my other scripts which have been giving me the same problem.

                             

                            Regards,

                            Liza

                            • 11. Re: Script to go back to original layout AND original record
                              ariley

                              Liza,

                               

                              If you can't create a custom function, just put "-10000" in your window. But in that case you will have to do it one by one everywhere.

                               

                              Not a big deal.

                               

                              Best,

                              Agi

                               

                              Agnes B. RileyFileMaker 10 and 11 Certified Developer

                              http://www.zerobluetech.com

                              ZeroBlue Technology Solutions

                              where your data goes to work

                               

                              Member, FileMaker Business Alliance

                              Member, FileMaker Technical Network

                               

                              FileMaker Advanced 11.3 on Mac OS X 10.6.8

                               

                              "Imagination is more important than knowledge..."

                                 /Albert Einstein/

                              • 12. Re: Script to go back to original layout AND original record
                                liza

                                Thanks a lot Stephen, this also helps. Do I still have to add to the end of the script "Allow User Abort (on)"? Or can I just leave it off until the script exits?

                                • 14. Re: Script to go back to original layout AND original record
                                  ariley

                                  User abort options die when the script exits. Sometimes it makes sense to tun them on and off during the script, but that can be defined based on what you're doing. In a lot of cases it's ok to just turn it on off in the beginning, and let it be. Same goes for error trapping. You can run that off/on depending on when you need it. 

                                   

                                   

                                  Regards,

                                   

                                  Agnes B. Riley

                                  FileMaker 10 and 11 Certified Developer

                                  http://www.zerobluetech.com

                                  ZeroBlue Technology Solutions

                                  where your data goes to work

                                   

                                  Member, FileMaker Business Alliance

                                  Member, FileMaker Technical Network

                                   

                                  FileMaker Advanced 11.3 on Mac OS X 10.6.8

                                   

                                  "Imagination is more important than knowledge..."

                                     /Albert Einstein/

                                  1 2 Previous Next