2 Replies Latest reply on Nov 24, 2008 6:39 AM by DrDave

    Saving a Found Set



      Saving a Found Set


      Is there a way of saving, then restoring a found set?


      Assume I'm in a layout that has a found set. I then want to run a script that


      selects a layout

      show all records

      do stuff

      select the original layout

      restore the original found set


      Suggestions are appreciated. 


      P.S. It would be awesome if there was a function that "saved everything" about a current state. :-)

        • 1. Re: Saving a Found Set

          Hi DrDave 


          The way I have done this in the past is to create a new layout assigned to a new Table Occurrence of the same Base Table you are using, I will call these HoldingTO and HoldingLayout. The first thing you will do in your script is to store the current found set in this TO and then go back to your original layout and perform your actions, Because you are looking at the same data through a separate Table Occurrence the found set will not be affected.


          The way to get the found set onto into another table occurrence is by using the Go to Relater Record script step, Getting related records from the Table Occurrence your found set in in, and showing results using the layout of the holding TO. The Option Dialog will be something like this.


          Get related records from: ActionTO

          Show records using layout: HoldingLayout (HoldingTO)

          Result Options: Tick "Show only related records" "Match all records in current found set"


          This will go to all the records in your original table on the new layout, you can then go back to the original layout, perform you script actions. When you have finished go to the new layout and perform another Go To Related Records, but the first two options in reverse.


          Your script will look something like this:



            # Isolate current found set

            Go to Related Records [ Match found set from "ActionTO"; Using Layout "HoldingLayout" (HoldingTO)]

            # Go back to Action layout to perform actions.

            Go to Layout ["ActionLayout" (ActionTO)]

            Show all records

            #do stuff

            #Restore found set

            Go to Layout ["HoldingLayout" (HoldingTO)]

            Go to Related Records [ Match found set from "HoldingTO"; Using Layout "ActionLayout" (ActionTO)]



          I hope this makes sense and helps.

          • 2. Re: Saving a Found Set

            Thank you Orlando for taking the time to offer this suggestion. That's great.


            Since I'm new to FM, I'll need some time to "work this through," but will get back to you as soon as I can put the related code together.


            Thanks again.