1 Reply Latest reply on Apr 5, 2012 12:49 PM by philmodjunk

    Buttons and sort Scripts

    eldoonmad

      Title

      Buttons and sort Scripts

      Post

      Here is what I have :

      A database for tracking invenotry and assets including tables for the assets as well as users they will be assigned to. 

      This is for a school district so assets are assigned to users as well as classrooms. School sites are listed under a value list that can be selected in form view of the Assets table. Room numbers are enetered in manually in a text field.

      What I would like to do :

      I am trying to make this database as easy as possible for my end users that will be doing the inventory. So I am trying to include all actions they might need to perform in buttons. I do not want them to have to touch any of the FMP controls.

      This last section I am trying to make has to do with reports. Basically I would like one layout full of buttons for the most common reports. One report being a list of all items assigned to a specific classroom. Now I know I can do a script for the button that will take the user to the "Asset" list layout, then sort by a classroom and then sort by a room, however, I am not sure how I would make those variables available for the user to manually select and then click the button, print report.

      So I would like the user's experience to be like this. 

      They click a button at the top of the page that would take them to the Reports layout (No problem, i can do that)

      They would see a dropdown menu (my value list) and select the School site (The value list is already set up)

      They would then type in a text field the room number

      They would then click the button print reports and out it comes. (I know how to create buttons and assign scripts)

       

      My main questions:

      1) What type of layout would be best for this, since they wont be creating records in it just clicking buttons?

      2) What would be the best way to create fields for the variables, Site and Classroom

      3) What would be the best way to incorporate those variable's values into the script

       

      Thank you for any help

        • 1. Re: Buttons and sort Scripts
          philmodjunk

          Define a field For your drop down list of school sites. Define a field for your room number field. Set both fields up with Global storage. Since these are fields with global storage, they can be defined in any table in your database and they can still be accessed from any layout and any record in your file. I often set up a "globals" table to define all global fields not part of a relationship.

          Then your script can run like this:

          Enter Find mode [] //clear the pause checkbox
          Set field [Yourtable::site ; YourTable::globalSiteField]
          Set Field [YourTable::Room ; YourTable::globalRoomField]
          Set Error Capture [on] //keeps error dialog from interrupting your script if no records are found
          Perform Find[]
          Sort [Restore ; no dialog ]