2 Replies Latest reply on Jun 2, 2013 8:50 AM by philmodjunk

    Back to same record after zero found count

    JohhnyHilly

      Title

      Back to same record after zero found count

      Post

           Using a perform find, I am going between layouts (based on the same table). If the FoundCount is zero or found set has zero records in it, in scripting terms how to I go back to the other layout with the original record? I have been struggling to crack this as when there are zero records in the found set, there is no way to use Go to Related Record or Go to Layout [Original] etc, so how would I go back to the original record on the 1st layout? Thanks

        • 1. Re: Back to same record after zero found count
          RickWhitelaw

               Set Error Capture on at the beginning of your script. After  Perform Find  use If(GetLastError= 411) Go To Layout(your layout) . Check to see if 411 is the correct error number for no records found. I'm not at a computer right now.

          • 2. Re: Back to same record after zero found count
            philmodjunk

                 That will work if the records are based on different occurrences of the same table. If they specify the same table occurrence in Layout Set up..., this would return you to your original layout, but not your original record.

                 You could use different occurrences of the same table or you can save the primary key of the current record in a variable before performing the orignal find. Then, if no found records are detected (I use Get (FoundCount ) to check for that), your script can both return to the original layout and use the value in the variable to perform a find to pull up the original record.

                 Note that this only restores the current record, not the original found set.