1 Reply Latest reply on Feb 29, 2012 6:32 PM by philmodjunk

    Prompt for User Input on Report



      Prompt for User Input on Report


      Greetings All,

      I'm just starting to use FMP 11 and have a few (very basic) scripts under my belt. I'm trying to create a script that will run a report which will produce a prompt (popup window) asking the user to input information which will decide what the report will show. At the most basic level, I have a form of various fields - one of them being "Status". I'd like the script to run the report but prompt the user to enter the "Status" that they want the report to run. While I could just make separate scripts to filter for each status, I'm sure the prompt field can't be all that hard to do for someone more familiar with FMP.

      I've attached a screenshot of what I have so far which displays all statuses. Any help would be GREATLY appreciated!






        • 1. Re: Prompt for User Input on Report

          The simplest approach is to use a global field with show custom dialog like this:

          Show Custom Dialog ["Please enter a Status"] (Specify gStatus as the input field to use with this custom dialog. us button 1 as OK, Button 2 as Cancel.)
          IF [ Get ( LastMessageChoice ) = 1 // OK was clicked]
              Go To layout [Safety Deviations]//specify the layout to be used for this report here
              Enter Find Mode [] //clear the pause check box
              Set field [Safety Deviations::Status ; Safety Deviations::gStatus]
              Set Error Capture [on]
              Perform Find []
              Sort Records [Restore ; No Dialog]
              Enter Preview Mode[]
              Print Setup
          End If

          Note: gStatus must have global storage specified or this script will not work as written. Also, I can't see what criteria is specified in the Perform Find step in your script, so you may need additional set field steps to specify all the needed criteria for your find.