5 Replies Latest reply on Aug 2, 2013 10:45 AM by jdhelle

    Using Find within a Multi-Tab Layout

    jdhelle

      Title

      Using Find within a Multi-Tab Layout

      Post

           I have a layout that contains serveral tabs for different types of recording that I own.  On each of the tabs I have a button that changes to a photo layout.  The button performs #1 below.  On the photo layout I have an exit button that goes back to the layout that sent me to the photo - #2 below.  However, when returning from the photo layout, it always returns to the first record, not the record that I was viewing prior to going to the photo tab.  

      1, Going To the photo layout:

           Set Variable [$$LayOutName; Value:Get (LayOutName)]

           Go to Layout ["Blue Amberol Photo" (Owned_Music_Library)]

            

      Returning from the photo layout:

           Go to Layout [$$LayOutName]

           Go to Object [Object Name: "BA Tab"]

            

           I have tried using the Get (RecordNumber) in a variable, but when using find the RecordNumber = 1.  So when you return to the prior layout you get record #1 on the BA Tab.

           I have tried using the Get (RecordID) in a variable, but I have this problem - I find a record, the RecordID is 16,500.  When returning to the original record and go to RecordID 16,500 I get an error because for this particual recording type I only have 845.

            

           How do you return to the same record that you were viewing prior to looking at the photo?

        • 1. Re: Using Find within a Multi-Tab Layout
          philmodjunk

               Simply returning to the original layout should leave you on the same record unless some activity on that other layout changes the current record for your original layout. That could easily happen if both layouts refer to the same Tutorial: What are Table Occurrences? in Layout Setup.

               One option is to duplicate your table occurrence and specify the duplicate table occurrence on the other layout. Then finds/sorts/etc on that layout will have no effect on the current record on the original layout.

               Another option is to open a new window for the other layout and then return to this layout by closing that window. This also will keep any actions on that other layout from changing the current record on the original layout.

               A third option would be to store the record's primary key (auto-entered serial number) in a variable when you leave the layout. Then you can perform a find for that value to return to the correct original record.

          • 2. Re: Using Find within a Multi-Tab Layout
            jdhelle

                 I selected the 'primary key' option and it works great!

                 Thank you so much!

                  

            • 3. Re: Using Find within a Multi-Tab Layout
              jdhelle

                   Now that the original problem is solved, a new problem has come up.

                   Once I return to the original record, going to the next, first or last record no longer functions.  

              Going to the Photo:

                   Set Variable [$$LayoutName; Value:Get (LayoutName)]

                   Set Variable [$$RecID; Value:Owned_Music_Library::PrimaryKey]

                   Go to Layout [Blue Amberol Photo" (Owned_Music_Library)]

              Returning from the Photo:

                   Enter Browse Mode []

                   Go to Layout [$$LayoutName]

                   Go to Object [Object Name: "BA Tab"]

                   Perform Find [Restore}

              Find setting:

                   Find Records Owned_Music_Library::PrimaryKey: [=$$RecID]

              • 4. Re: Using Find within a Multi-Tab Layout
                philmodjunk
                     

                          Once I return to the original record, going to the next, first or last record no longer functions.

                     And this would be expected as performing the find for the primary key pulls up a found set of just that one record. There then is no previous or next record in the found set to go to. Your script preserves the current record, but does not preserve the current found set. After performing this find, you could do a show all records and (if needed) a sort records to restore a found set of all records in the table in a specific order. (your current record should not change with those two steps.)

                     If you don't have a found set of all records, you'll need to look at the other options I mentioned.

                • 5. Re: Using Find within a Multi-Tab Layout
                  jdhelle

                       I ended up using the 'New Window' and 'Close Window' option.  This does not loose the found data set.

                       Thank you again!