7 Replies Latest reply on Jan 17, 2015 3:35 PM by philmodjunk

    How to tie a button to a specific record

    murfmv

      Title

      How to tie a button to a specific record

      Post

      I'm trying to create a graphical database where a user would click on a specific part number on part diagram and go to that part number information page.  There is very little information on creating a button that will go to a specific record .  I need some help.  Is it possible?

        • 1. Re: How to tie a button to a specific record
          philmodjunk

          It's very possible. Clicking a button performs a script. That script simply needs the needed Identifier value, such as the value of the record's unique identifier (called a primary key). Such a value can be used to perform a find for the record, Go to it via Go to related records or to display it on the current layout via fields from that related record. Much depends on the design of your database. This is a value that might be hard coded into the script, passed to it from the button as a script parameter, or in some cases, the very mouse click puts the focus on a particular record and/or field and that serves as a path to the needed value.

          An interesting option for iOS users using an iPad or iPhone is to use the OnGestureTap script trigger to determine the precise coordinates of the section of the layout that was tapped and to use those to determine what part of an image was tapped by the user.

          In FileMaker Pro, you'd have to cover a portion of your layout with a grid of invisible buttons, each set to pass a different value to a script to achieve the same result.

          • 2. Re: How to tie a button to a specific record
            murfmv

            Thanks Phil, I got it to work by using the find command.  Of course that will mean as many script statements as there are parts, but will be OK!

            • 3. Re: How to tie a button to a specific record
              philmodjunk

              Yet if you pass the part number to the script via a script parameter, you need have only one script....

              • 4. Re: How to tie a button to a specific record
                FilmUser

                Phil - Following this -

                      "Yet if you pass the part number to the script via a script parameter, you need have only one script...."

                As in with a variable based on the identifying value?

                • 5. Re: How to tie a button to a specific record
                  philmodjunk

                  No as in entering a value into the button's optional script parameter box. The script can then use Get ( ScriptParameter ) to access the value thus passed to it.

                  • 6. Re: How to tie a button to a specific record
                    murfmv

                    Could somebody please give an example of how to pass a part number to the script a script parameter?

                     

                    Yet if you pass the part number to the script via a script parameter, you need have only one script....

                    • 7. Re: How to tie a button to a specific record
                      philmodjunk

                      See the section circled in Red. When you open either button setup or a Dialog for setting up a script trigger, there's a button named "select" that you click to open the specify script script dialog shown. You can then enter an explicit value or a calculation (such as you might define for a calculation field) in this box. (Click edit to open the specify calculation dialog.)

                      The script performed by clicking this button can then use the expression:

                      Get ( ScriptParameter )

                      to access the value passed via the value or expression entered into this box.

                      So you can put multiple buttons on your layout and by putting a different value or expression in the optional script parameter box, pass different values to the same script. (I've set up "calculators" in popovers where each button clicked appends a different digit (0 thru 9) to a field...)