2 Replies Latest reply on Feb 1, 2012 8:27 PM by WilliamMaslin

    Question about script parameters and buttons



      Question about script parameters and buttons


      I've been working on an IWP solution using Filemaker 9 and trying to get the script in Special Edition Using Filemaker 8 on page 666 to work. So far, after many combinations and permutations, I'm at a total loss.

      This script is used to determine how many records to move forward or backward when the user clicks a Next or Prev button and apparently uses script parameters.  However, I can't for the life of me figure out how script parameters work with buttons.

      They say the script step used would be Go to Record/request/page... by calulation.

      So, let's call my script "Go Forward" and it has a single step: Go to Record/Request/Page ... by calculation


      And here's the calculation from the text:

      Let ( [
      curRec = Get ( RecordNumber );
      jumpSize =
      Case (
      Get ( LayoutViewState ) = 1; 25;  // it's in List view
      Get ( LayoutViewState ) = 2; 50;  // it's in Table view
      1); // it's in Form view
      direction =
      Case (
      Get ( ScriptParameter ) = "Next"; 1;  //  jump forward
      Get ( ScriptParameter )  = "Prev"; -1 );  //  jump backward
      newRec = curRec + (jumpSize * direction) ] ;

      Case ( newRec > Get ( FoundCount ) ; curRec ; newRec)


      Now, can someone tell me how to link this calculation to a next or previous button?  I think I have the first step down correctly :-):

      1. Make a button can type Next on it. My competence ends with this step.

      2. Now, what do I chose in the button dialog? I assume it's the "Go Forward" script. But if the calculation above is ALREADY in the "Go Forward" script...what goes in the script parameter edit box?




        • 1. Re: Question about script parameters and buttons

          Use the button tool to add a button object ot your layout or select an object you want to turn into a button that's already on the layout and select button setup...

          Select the Perform script option and click the specify... button to bring up the specify script dialog. In the bottom of this dialog is found a text box titled "optional script parameter". Enter "Next" in this box for a next button or enter "Prev" for a previous button.

          • 2. Re: Question about script parameters and buttons

            Thanks for your answer!  I had the whole script parameter concept backwards.  I thought the calculation went in the "optional script parameter" box.  I checked my books before posting but the examples seemed to gloss over what actually servered as the script parameter.  I have the Filemaker 9 Developers Reference and it's helpful but usually leaves me wanting more.  It would be great if there were a larger book - or a website - where more numerous and more extensive examples of ALL calculation and script steps could be posted.  The old Scriptology book seemed to have a lot more examples...but things weren't as complex back in those days. Smile 

            And here's another mystery: Special Edtion Using Filemaker 9 by Jesse Feiler is largely a word for word copy of Special Edition Using Filemaker 8 but there is no mention of the original authors: Love, Lane and Bowers.  It's no big deal but it's curious to me.  Must be one of those publishing industry things.