• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 9. Extending the Interface with ... > Making a Find Layout with a Script

Making a Find Layout with a Script

Because setting up a Find request takes time and typing, you'll frequently find yourself creating scripts that hold your typical search criteria. But you can't always predict what the criteria will be, although you might be able to predict the category. For example, every once in a while you may want to print out a record of your receivables. For those occasions you can create a generic date-search script with its own layout that generates a report when it's done. Once you have the script, you can run it from the menu bar, or from any layout that contains a script button you create.

To create a layout for searching:

1.
If the script you are creating requires a Sort, perform the Sort. If this script will use a Print command, set the Print/Page Setup to the desired settings.

2.
Choose View > Layout Mode (Ctrl+L/Command-L).

3.
Choose Layouts > New Layout (Ctrl+N/Command-N). In the New Layout dialog box, type a name for the layout. For this example, we'll use Date Find.

4.
Choose Blank layout as the layout type and click Finish (Figure 9.1).

Figure 9.1. Since only one field will be used on this layout, choose the Blank layout.


5.
Drag the Header and Footer parts up until they disappear, since we only need the Body part.

6.
Drag the Field tool onto the layout. From the Specify Field dialog box that appears, choose your date field. Here, we add Sale Date (Figure 9.2).

Figure 9.2. Choose the field for the Find criteria in the Specify Field dialog box.


7.
Using the Text tool, add directions on how to use the layout and arrange the text and field on the layout page (Figure 9.3).

Figure 9.3. Add directions to the layout to explain how to use it.


Next we'll create the script to do the Find request and print the result.

8.
Choose Scripts > ScriptMaker. In the Define Scripts dialog box, type a name for the script. (We use Print Sales Report.) Click Create.

9.
When the Script Definition dialog box appears, delete the default script in the assembly window by clicking Clear All.

10.
From the step list on the left, double-click Go to Layout.

11.
In Options, choose the layout you just created from the Specify drop-down list (Figure 9.4).

Figure 9.4. The first step in this script switches to the Date Find layout.


12.
From the Navigation section in the step list on the left, double-click Enter Find Mode.

13.
In Options, uncheck the Restore find requests box. Leave the Pause box checked (Figure 9.5).

Figure 9.5. The script pauses to allow you to enter the Find criteria.


Since you will choose different dates each time the script runs, we don't want to use the Restore option. The Pause option makes the script wait for your input before continuing.

14.
From Sort/Find/Print in the step list on the left, double-click Perform Find. Uncheck the Restore find requests box (Figure 9.6).

Figure 9.6. Since you'll enter new Find criteria each time, don't use the Restore option.


15.
If you want to use a Sort, double-click Sort in the list of steps and leave the Restore sort order box checked (Figure 9.7).

Figure 9.7. If the script will use a sort, you can check the Restore option.


16.
From the step list on the left, double-click Go to Layout.

17.
In Options, choose the layout you want the found set to appear in from the Specify drop-down list (Figure 9.8).

Figure 9.8. This script will switch to the Sales Report layout before printing.


18.
From Sort/Find/Print in the step list on the left, double-click Print Setup (Page Setup on the Mac). Leave the Restore setup options and Perform without dialog boxes checked (Figure 9.9).

Figure 9.9. The Print/Page Setup with the Restore option will create the correct print settings.


This step will set the Print/Page Setup options for the printing in the next step.

19.
From the step list on the left, double-click Print. If you want to see the Print dialog box, uncheck the Perform without dialog box (Figure 9.10).

Figure 9.10. If the Perform without dialog box is checked, you won't be prompted before printing.


20.
From the step list on the left, double-click Show All Records.

This will reset the database to All Records after you've finished printing the found set.

21.
From the step list on the left, double-click Go to Layout. Leave the options untouched (Figure 9.11).

Figure 9.11. Use the Go to Layout step to return to the layout you were viewing when you ran the script.


This step will return you the layout from which the script was run.

22.
Click OK, then Done.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint