Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.filemaker > #2114

Re: Problem in Setting Up a Script Sort

From Helpful Harry <HelpfulHarry@BusyWorking.com>
Newsgroups comp.databases.filemaker
Subject Re: Problem in Setting Up a Script Sort
Date 2015-03-19 13:26 +1200
Organization Aioe.org NNTP Server
Message-ID <190320151326581452%HelpfulHarry@BusyWorking.com> (permalink)
References <1m1fyqf.ov474b1lzxpn9N%csampson@inetworld.net> <180320151826106831%HelpfulHarry@BusyWorking.com> <1m1hfhy.wxvnpgrsdgczN%csampson@inetworld.net>

Show all headers | View raw


In article <1m1hfhy.wxvnpgrsdgczN%csampson@inetworld.net>, Charles H.
Sampson <csampson@inetworld.net> wrote:
> Helpful Harry <HelpfulHarry@BusyWorking.com> wrote:
> > In article <1m1fyqf.ov474b1lzxpn9N%csampson@inetworld.net>, Charles H.
> > Sampson <csampson@inetworld.net> wrote:
> > > 
> > > I have a recurring but not consistent problem with sorting in a script.
> > > From time to time I get into a situation where, when trying to specify
> > > the sort parameters, I'm only allowed to choose fields from something
> > > that ScriptMaker call "Current Table" and it's not the table that I want
> > > to sort. All other tables are greyed out in the drop-down menu.
> > > 
> > > It doesn't happen every time. I've tried such unlikely things as
> > > changing the mode I'm in while working on the script. Browse, Find,
> > > Layout, or Preview makes no difference.
> > > 
> > > What am I doing wrong?
> > 
> > Just a complete guess, but maybe the current record doesn't have any
> > related records in other tables to sort with.
> 
> I'm not following this, Harry. I thought that I could go to a table
> using the Go To Layout command at any time and sort the records in that
> table. Without any concept of related records. Of course, if I want to
> sort the records of a table using data from another table, the two
> tables have to be related.
> 
> > You could try adding Sort commands to Scripts in the old way:
> > 
> >    - enter Browse Mode with a set of records
> > 
> >    - manually Sort the records by the required field(s)
> > 
> >    - go to the Script and insert the Sort command,
> >      making sure to set the "Restore" option on
> >      (assuming newer versions of FileMaker still have
> >      the Restore option)
> 
> That works! I don't understand why, but it works. Why an action that I
> take as a user of the database (sorting the records of a table in browse
> mode) has any effect on what I can or cannot do as a script programmer
> is a concept beyond my grasp. Nonetheless, when I sorted the table in
> question and went back to ScriptMaker, that table was now the Current
> Table (whatever that means) and I could set up my script sort. At the
> same time, I now couldn't sort any other table.
> 
> > Just remember whenever editing that Script from then onwards to tell
> > FileMaker to "Keep" the stored Sort Order (instead of replacing it with
> > whatever the current Sort Order happens to be at that editing time).
> 
> In FMP8, when I set up a sort in a script, it appears in the text of the
> script as Sort [Restore]. I have no idea what that means and the Pogue
> Press book isn't telling. In other words, the "Restore" is automatically
> inserted ScriptMaker.

When being added to a Script, some commands (Sort, Print, Find, etc.)
can save the most recent manual options within the Script. Whenever the
Script is performed, the Restore option will mean FileMaker retrieves
those saved options from the Script, rather than using whatever the
current options may be.

For example, if you Sort the records by FieldA and then create a Script
with the Sort [Restore] command, then every time you perform that
Script the records will be resorted by FieldA ... even if you have
sorted them by FieldB prior to performing the Script.

This is why the Enter Find Mode and Perform Find commands can cause
"weird" problems if the Restore option is turned on by accident -
FileMaker will use the stored Find Requests, which might then be
*added* to or altered by the user / Script. That means you aren't
telling FileMaker to find what you think you are.

Another example is with Page Layout. You might be looking at a report
you want to print, so you set the Page Layout manually to Landscape and
then run a Script to print it ... but if the Script contains a Page
Setup [Restore] command, then it might (for example) restore a portrait
set-up that was saved with the Script and ignore your change to
landscape.



In ye olde days of FileMaker, these saved options were the only way to
perform some tasks - you could not change which fields were used for
sorting, etc. from within the Scriptmaker command itself. Instead you
had to Sort the records manually, go into Scriptmaker to edit a Script,
then when closing the Script tell FileMaker to replace the stored
options with the new ones.

Helpful Harry  :o)

Back to comp.databases.filemaker | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Problem in Setting Up a Script Sort csampson@inetworld.net (Charles H. Sampson) - 2015-03-17 18:51 -0700
  Re: Problem in Setting Up a Script Sort Helpful Harry <HelpfulHarry@BusyWorking.com> - 2015-03-18 18:26 +1200
    Re: Problem in Setting Up a Script Sort csampson@inetworld.net (Charles H. Sampson) - 2015-03-18 13:56 -0700
      Re: Problem in Setting Up a Script Sort Helpful Harry <HelpfulHarry@BusyWorking.com> - 2015-03-19 13:26 +1200
        Re: Problem in Setting Up a Script Sort Helpful Harry <HelpfulHarry@BusyWorking.com> - 2015-03-19 16:08 +1200
        Re: Problem in Setting Up a Script Sort csampson@inetworld.net (Charles H. Sampson) - 2015-03-20 00:00 -0700
          Re: Problem in Setting Up a Script Sort Helpful Harry <HelpfulHarry@BusyWorking.com> - 2015-03-21 09:51 +1200
  Re: Problem in Setting Up a Script Sort Howard Schlossberg <howard@nospam.fmprosolutions.com> - 2015-03-18 10:39 -0700
    Re: Problem in Setting Up a Script Sort csampson@inetworld.net (Charles H. Sampson) - 2015-03-20 00:00 -0700

csiph-web