From Dwayne Wright - www.dwaynewright.com
This is a series of discussions on the breakdown of a monthly sales report. This report is designed to be able to be reused in just about any sales report situation. The total script itself can be found by clicking here.
ABOUT THE SHOW CUSTOM DIALOG BOX
In the above set of script steps, I’m presenting the user with a dialog box to pick the month they want to run the report in. I’m using a combination of FileMaker design elements, which is common in complex scripts.
Set Field [ MonthySales::~sm_Month; Case(
Month(Get(CurrentDate)) < 10; "0" & Month(Get(CurrentDate));
In the first set field script steps, I’m setting the field that I’m going to show in my custom dialog box to the current month data. Another way to go is to set the field to empty. I’m thinking that most users will want to run the report on the current month or it is handy for them to see the format of how to enter in the correct data for the report.
Set Field [ MonthySales::~sm_Year; Year(Get(CurrentDate)) ]
In the next script steps, I’m setting my reporting field to the current month. This is jumping the gun a little bit but it’s there anyway.
Show Custom Dialog [ Title: "REPORT BY MONTH SELECTION..."; Message: "Please enter in the month and year you want to report on."; Buttons: “OK”, “Cancel”; Input #1: MonthySales::~sm_Month, "Month"; Input #2: MonthySales::~sm_Year, "Year (all four digits)" ]
In the Show Custom dialog, I’m showing the user the dialog box in which to enter in their selected date or allowing them to cancel the report. The Show Custom Dialog is a close as FileMaker comes to allowing you to customize dialog boxes. You can show a custom message with up to 3 buttons to choose from. You must then script a nested IF statement to capture what the user chose and branch accordingly.
#CANCEL OPTION cancel script if the user chooses to do so from the dialog box.
If [ Get(LastMessageChoice) = 2 ]
In the If [ Get(LastMessageChoice) = 2 ] section, I’m trapping to see if they clicked the Cancel button in the dialog box and halting the script accordingly.
More info about the author and FileMaker in general, contact me at email@example.com.
© 2007 - Dwayne Wright - dwaynewright.com
The material on this document is offered AS IS. There is NO REPRESENTATION OR WARRANTY, expressed or implied, nor does any other contributor to this document. WARRANTIES OF MERCHANT ABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED. Consequential and incidental damages are expressly excluded. FileMaker Pro is the registered trademark of FileMaker Inc.