4 Replies Latest reply on Aug 4, 2013 2:15 PM by philmodjunk

    Sort Issue Moving Between Tabs

    jdhelle

      Title

      Sort Issue Moving Between Tabs

      Post

           I have a layout with multiple tabs and each tab has a unique name.  Let's say I'm on the 'DD Tab' and I select my 'Next' button 3, 4, 5 times etc.; the 3rd, 4th, or 5th record displays and everything is fine.  

           Wnen I switch to a different tab, say the 'BA Tab', I have a script trigger that 'On TabSwitch' it performs 'Determine Tab'.  'Determine Tab' finds what tab you have switched to, in this case 'BA Tab', and performs the 'Blue Amberol Script'.  

           However, when the 'BA Tab' displays, it begins on the 3rd, 4th, or 5th, not the first.  When I view the found data in a table there are only Blue Amberol records and they are sorted correctly. 

           I have proven that the 'Determine Tab'  is finding the correct $$TabName using the Speak command.  I have also proven that the correct Find and Sort Script, in this case the 'Blue Amberol Script' is running by again using Speak.  

           Any idea why it display starts at the 3rd record instead of the 1st on the new found set?  

           What's even more odd if after it's displaying the 'BA Tab' with the 3rd record if I run the 'Blue Amberol Script' manually, it then displays the first record.

            

           Here are the scripts:

      Determine Tab

           Set Variable [$$TabPanel; Value:Get(TriggerTargetTabPanel)]

           Set Variable [$$TabName; Value:GetValue($$TabPanel; 2)]

           If [$$TabName = "DD Tab"]

                Perform Script ["Diamond Disc"]

           Else If [$$TabName = "BA Tab"]

                Perform Script ["Blue Amberol"]

           (and it continues to check all the other tab name possibilities)

           Else

                Show Custom Dialog ["Error"; "Determine Tab - No Tab Found"]

           End If

            

      Find and Sort Scripts

      Diamond Disc Script

           Go to Layout ["Record Detail Tabs" (Owned_Music_Library)]

           Go to Object [Object name: "DD Tab"]

           Enter Find Mode []

           Perform Find [Restore]    ------  Find Records = Owned_Music_Library::Medium: [Diamond Disc]

           Sort Records [Restore; No dialog]   -----  Sorting on Medium and Coupling Number

           Go to Record/Request/Page [First]

            

      Blue Amberol Script

           Go to Layout ["Record Detail Tabs" (Owned_Music_Library)]

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

           Enter Find Mode []

           Perform Find [Restore]    ------  Find Records = Owned_Music_Library::Medium: [Blue Amberol]

           Sort Records [Restore; No dialog]   -----  Sorting on Medium and Cylinder Number

           Go to Record/Request/Page [First]

            

        • 1. Re: Sort Issue Moving Between Tabs
          philmodjunk

               I'm not sure what you mean by "the 3rd record", but sorting the records should not change which record is the current record. Say you have 3 records in your found set with the following values in a text field:

               A

               D

          B

               And the record in Red is the current record. Then you sort your records by this field in ascending order:

               A

          B

               D

               The record in red is still the current record, but now it is the 2nd record in the found set. In form view, this means that the record shown on your layout does not change when you sort the records, but the numbers dealing with the current record in the status area tool bar change to show the the current record is now at a different position within the found set of records.

          • 2. Re: Sort Issue Moving Between Tabs
            jdhelle

                 Let's say I'm looking at the DD Tab, which has 2000 records in the found set.  I select my 'Next Button' 3 times so I'm looking at the 3rd record in the set.

                 Now I switch to the BA Tab, which finds a new set of 885 records because switching tabs causes the Blue Amerbol Script to run.  However, the first record that display is the 3rd record in the set instead of the 1st record.

                 I thought when you find a new set, and 'Go to Record/Request/Page [First], the display would be at record #1 not record #3 from the previous found set.  

                 Am I missing something in the Diamond Disc Script and the Blue Amberol Script that would force it to the first record in the new found set?

                  

            • 3. Re: Sort Issue Moving Between Tabs
              SteveMartino

                   Just another probably obvious tip:  I would double check your sort options in the other 2 scripts (uncheck Perform without dialog), and run them thru the Script Debugger to see whats going on.

              • 4. Re: Sort Issue Moving Between Tabs
                philmodjunk

                     Go to Record [First]

                     Should put you on the first record. 

                     You might check to see if there is some other script involved, such as one performed by OnRecordLoad that might be changing the current record after the first script completes.