13 Replies Latest reply on Aug 14, 2009 1:56 PM by timothy2k

    Option to go back to original record?

    timothy2k

      Title

      Option to go back to original record?

      Post

      Ok, so I see script options when trying to go back to a certain record for:

       

      First record

      Last record

      Previous

      Next

      Calculation

       

      Isn't there an option to just stay on the current record? (or go back to it, after populating some other tables and fields)??

       

       

      I tried using calculation, but no matter what I set, it seems to go back to the first record in the table every time the script is done running.

       

      My calculation is trying to use

      Estimate::estimate_id= QuoteItem::estimate_id

       

      And the script step says 

      Go to layout ["Request for Estimate"] (Estimate)]

      Go to record/Request/Page [No dialog:Estimate::estimate_id=QuoteItem::estimate_id]

       

      And when looking at the data viewer, I see those two fields are correct and they match, yet the script keeps going to 1st record in the table every time it finishes.

        • 1. Re: Option to go back to original record?
          philmodjunk
            

          Go to Record can only go to a record by it's current order in the current found set.

           

          You can go to record 1, 2 , 3, 4....

           

          You can't go to a record "where a field has a value of..."

           

          Estimate::estimate_id=QuoteItem::estimate_id will at best return the value 1 (if it's true) and this takes you to the first record in your found set. In fact, if you didn't do anything at all to change records, you might find you are already on exactly the record you want. (Unless some action of your script has taken you to a different record in the same found set of records.)

           

          If you need to make sure you are returning to the same record, first store the current record position in a variable

          Set Variable [$RecNumb; Get ( Recordnumber ) ]

           

          Then to return to this record, use

           

          Go to record/Request/Page [No dialog; $RecNumb]

          • 2. Re: Option to go back to original record?
            timothy2k
              

            Makes complete sense now, and works like a charm.  Thank you sir.

             

            (Wondered why it kept asking me to choose which record number I wanted to go to, even though I "thought" I was specifying it already) : ))

             

             

             

             

            • 3. Re: Option to go back to original record?
              timothy2k
                

              Quick follow up- what additional/different technique is needed to do this on a layout that is only showing a portal of records?

               

              The same technique that worked on a regular layout does not seem to work for a portal layout.......it goes to a blank portal when I try it.

               

              Thanks!

              • 4. Re: Option to go back to original record?
                ninja
                  

                Howdy,

                 

                Get(PortalRowNumber) and Go To Portal Row

                 

                ...but why would you have a layout that only had a portal?  Why not have your layout be on the same table as your records and view it in list view?  It may make life a bit simpler...you could get to this layout using GoToRelatedRecord[] and then work from the reference of the table where the records actually are.  Just thinking out loud.

                 

                Enjoy the day!

                • 5. Re: Option to go back to original record?
                  timothy2k
                    

                  Good question.  I believe I need the portal by itself because it is actually two portals side by side, using a table that is related to two different tables. This was just my idea, which certainly doesn't make it the best one!

                   

                   

                   

                   

                   

                   

                  • 6. Re: Option to go back to original record?
                    comment_1
                      

                    Here's another option you could try:

                     

                    • open a new window;

                    • do your stuff;

                    • close the window

                     

                     

                    • 7. Re: Option to go back to original record?
                      philmodjunk
                        

                      comment wrote:

                      Here's another option you could try:

                       

                      • open a new window;

                      • do your stuff;

                      • close the window

                       


                      That's a cleaner option for Mac systems than windows. In windows systems, you'll need to do some additional window management as opening a new window automatically resizes the current window. That can produce some undesirable "window twitching" and leave your original window resized to a different setting than you started.
                      • 8. Re: Option to go back to original record?
                        timothy2k
                           Yea, this will be running mostly on a Windows machine....1 Mac also, but primarily Win.  I'll post back my results soon.
                        • 9. Re: Option to go back to original record?
                          ninja
                            

                          comment wrote:

                           

                          • open a new window;

                          • do your stuff;

                          • close the window

                           

                           


                          Depending on your record count, you can sometimes get away with

                           

                          • GoToLayout {the other layout};

                          • do your stuff;

                          • GoToLayout {original}

                           

                          While certainly less than "ideal", if your dbase is small enough the "twitch" is less noticeable than resizing windows.

                           

                           

                          • 10. Re: Option to go back to original record?
                            philmodjunk
                              

                            Here's how I minimize the window resizing on a Windows platform.

                             

                            The steps assume that you are using filemaker with the windows Maximized. 

                            Immediately after the step that generates a new window: (Could be GTRR, or New Window)

                            Move/Resize Window [Name:<insert name of original window here> ; Height: get ( ScreenHeight ) ; Width: get ( ScreenWidth ) ; Top: 0 ; Left: 0 ]

                             

                            Since the original window's name is often the same as your database file name, Get ( Filename ) is often a good expression to use as the Name: parameter.

                             

                            Then, once the new window is closed:

                             

                            Adjust Window [Maximize]

                             

                            These two script steps minimize, but do not eliminate the automatic window resizing that will take place on a windows platform. I understand from other posts in this forum that these steps are not needed for Mac systems. If that's the case you might want insert an if step that will only execute these steps if the client machine is not a Mac.

                             

                            • 11. Re: Option to go back to original record?
                              comment_1
                                

                              Ninja wrote:

                              comment wrote:

                               

                              • open a new window;

                              • do your stuff;

                              • close the window

                               

                               


                              Depending on your record count, you can sometimes get away with

                               

                              • GoToLayout {the other layout};

                              • do your stuff;

                              • GoToLayout {original}

                               

                              While certainly less than "ideal", if your dbase is small enough the "twitch" is less noticeable than resizing windows.

                               

                               


                              That won't work if you need to get back to a portal row - as requested by the OP.

                               

                               

                              I am not a Windows user, but I believe that if your original window is NOT maximized, there shouldn't be a problem with opening a new one - see:

                              http://fmforums.com/forum/showpost.php?post/174032/

                               


                              • 12. Re: Option to go back to original record?
                                ninja
                                  

                                Ninja wrote:

                                 Why not have your layout be on the same table as your records and view it in list view? 


                                True, comment.  But the act of going to another layout based on the child table (table portaled in) is meant obviate the need for working on the portal row.  Go to a layout based on the child table, do your stuff, then come back...no going to portal row needed.

                                 

                                Phil already gave a good solution for the OP...the follow-up post re: use of this solution on a portal row can be handled by avoiding the need to work in a portal via script... working instead within the target table from the reference of the target table and using Phil's previously posted approach.

                                 

                                Edit: As a mostlyPC user, having a window not maximized cuts down the viewable area by doubling the scrollbars.  It looks cluttered and users will often A) move the non-maximized window, B) drag the wrong scrollbar, C) get fed up with both A and B.


                                • 13. Re: Option to go back to original record?
                                  timothy2k
                                    

                                  I am using a variable to store the current portal row ($portal_row):

                                   

                                  Then using:

                                   

                                  go to layout [original layout]

                                  go to portal row [$portal_row]

                                   

                                  However, this still brings up a new, blank  record in the portal layout (it's not going to the original portal page that shows the records I started from)

                                   

                                  Do I need to store more than just the portal row? Maybe the actual portal ID or some other info about where I started from?

                                   

                                  **- update- I fixed this- needed to first go to related record, then to the portal row that was stored in the variable.