“Beam me up, …”

restorefs_10

At the last "Clarify Confituur" session (a Dutch-speaking FileMaker User Group), someone asked a question about how you can restore a found set, if you lose your found set during a script.
In this article we will show you with a simple technique that demonstrates how to do this.

To remain in the atmosphere of the "Clarify Confituur" session, let's create a new database called "BelgianBeers.fp7". (More info about the excellent Belgian Beers can be found on http://en.wikipedia.org/wiki/Belgian_beer )

In the second step, create a new layout (table view) and populate the database. Omit some records and make a custom sort order. In the example below we are on record 2. The found set is 6 records out of 10 and the found set is sorted by the field "hometown".

Now create a new script that will search for all "Red Wines" (which is a little bit stupid because this is a beer database ;-)

Run the script. You will see no records are found and we lost our last found set. Wouldn't it be nice if, when no records are found, we could restore the last found set, including the sort order and the current record?

To establish this, create a duplicate for the table occurrence "beer" and call it "temp". Don't create any relations between them. So both occurrences have the same base table "beer".

Create a new layout "temp" based on the table occurrence "temp". One of the nice things about table occurrences is, that every table occurrence can have its own found set.

Before you execute the search, you need to transfer the found set from table occurrence "beer" to table occurrence "temp". If no records are found, the found set "temp" will be transferred back to table occurrence "beer".

You don't need any complex custom function or complicated script to do this. You only need a single script step "Go to related record". Specify the current table occurrence as the table, and the layout of the other table occurrence as a layout. The script step "Go to related record" will transfer the current found set to another table occurrence. For someone new to FileMaker this can sound a little bit strange.
We call this method of transferring a found set from one occurrence to another occurrence "tele-porting" or the "beam me up, Scotty"-method.

Let's have a look at the store script:

And the restore script:

Now you need to stitch everything together in the search script.

Download the example file and don't forget to go and taste one of our delicious Belgian beers.

One Response to ““Beam me up, …””

  1. SHpartners / myFMbutler Blog » Blog Archive » “Final call for flight …” Says:

    [...] couple of weeks ago, we talked about the “Beam me up, Scotty” or “tele-porting” method. This technique described how you can transfer found sets from one [...]

Leave a Reply

You must be logged in to post a comment.