VISUAL QUICKPRO GUIDE FileMaker Pro 7 Advanced FOR WINDOWS AND MACINTOSH [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

VISUAL QUICKPRO GUIDE FileMaker Pro 7 Advanced FOR WINDOWS AND MACINTOSH [Electronic resources] - نسخه متنی

Cynthia L. Baron, Daniel Peck

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید











Using Loop in a Script


If the whole purpose of scripting is to automate repetitious actions, the Loop step is probably the ultimate scripting command. Any steps you nest (create inside) in a Loop will continue until you tell it to stop.

The script in "To date and print an invoice using Get functions" prints invoices one record at a time. That's nice, but you still have to sit at your computer and run each record individually. Place the Print Invoices script inside a loop that prints automatically whenever it finds a balance in an account, and you can completely automate your invoicing process.

To use Loop to print invoices



1 .

Choose Scripts > ScriptMaker (Control+Shift+S/Command+Shift+S). When the Define Scripts dialog box appears, click New.

2 .

When the Edit Script dialog box appears, type a descriptive name for the script in the Script Name text box (in this case Print All Invoices).

3 .In the step window on the left, in the Navigation section double-click Go to Record/Request/Page. Leave the Specify set to First.

4 .In the Control section, double-click Loop (Figure 8.31).

Figure 8.31. When you choose the Loop step, End Loop will be added automatically.


[View full size image]

As with If and End If, FileMaker automatically inserts both Loop and End Loop in the script-assembly list.

5 .In the script step list on the left, double-click If (Figure 8.32).

Figure 8.32. Since the If step is inside the loop, it will be executed for each loop.


Notice that If and End If are indented under the Loop step to indicate that they're running inside the Loop step.

6 .In the Script Step Options section, click Specify. When the Specify Calculation window appears, choose Balance Due from the field list on the left.

7 .Click the greater than (>) operator button and type 0 (Figure 8.33). Click OK. So far, this script looks to see if the Balance Due field is greater than 0.

Figure 8.33. The Print Invoices script will only run if there is a balance greater than 0.


[View full size image]

8 .In the script step list on the left, double-click Perform Script.

Perform Script is indented one more level than the If statement, and two indents more than Loop (Figure 8.34). This structure is a visual clue to help you keep track of complicated nested scripts.

Figure 8.34. The Perform Script step is contained by both the Loop and the If steps.


9 .In the Script Step Options section, click the Specify button and choose Print Invoices in the "Specify Script" Options dialog box (Figure 8.35). Click OK. If there's a balance in the first record, FileMaker will follow the steps in the Print Invoices script.

Figure 8.35. Rather than re-create the steps in the Print Invoices script, you can run it as a sub-script.


10 .To make sure that the next script steps are inserted after the If statement, click to select End If in the script-assembly list.

11 .Scroll down to the Navigation category in the script step list on the left and double-click Go to Record/Request/Page.

12 .In the Specify drop-down menu in the Script Step Options section, choose Next. Click the "Exit after last" check box (Figure 8.36).

Figure 8.36. Choose Next so the script will go to the next record.


These options tell the script to go to the next record in the table and exits after it processes the last one.

13 .Click OK twice to finish.



/ 227