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

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

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

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











Customizing Documents with If Steps


One of the tasks small businesses and free agents regularly do is generate repetitive documents. Whether it be contracts, form letters, or promotions, you build a "customized" document by combining relevant paragraphs of boilerplate text and specific names and addresses from a database. You end up keeping several versions of the same basic template around, and then you have to manually edit each one to customize it for a specific mailing or legal document.

Although you might automatically reach for a word processing program for these kinds of projects, think again. You can crank up FileMaker's scripting muscle to generate your documents with far less pain. It's true that the setup involves several separate tasks and will take a little time, but if you deal frequently with contracts (or any other text-based form with several modular variations), you'll find the results worth the effort. You can duplicate the script, make just a few changes, and use it for similar purposes.

The document script has some prerequisites before it will work its magic. First, you need several global storage fields to hold the boilerplate text paragraphs and modular choices. The text itself can be typed directly into the fields or cut-and-pasted from any existing text document. Second, you need to create two layouts: one to hold your mix-and-match templates and another formatted as a finished document. We'll create the fields and layouts before creating the script to put it all together.

Once you have your building blocks, you can design a script that constructs a document by combining the boilerplate text with the choices you make from the template elements.

Chapter 4. We'll use this calculated field to include a complete name and address field in the document the script creates.

To create modular text fields



1 .Choose File > Define > Database (Control+Shift+D/Command+Shift+D).

2 .When the Define Database dialog box appears, click the Fields tab. Type Paragraph 1 in the Field Name box, choose Text (Control+T/Command+T) as the data type and click Create (Figure 8.73).

Figure 8.73. Paragraph 1 is a Global field that will contain the text of the first boilerplate paragraph.


[View full size image]

3 .Click the Options button. In the Options dialog box, click the Storage tab. Check the "Use global storage" box and click OK (Figure 8.74). This creates a field to hold one paragraph of modular text.

Figure 8.74. This Global field will contain text.


4 .

Repeat steps 2 and 3 for as many additional modular paragraphs as you need.

In our example, we create a total of four Global fields, named Paragraph 1 through 4 (Figure 8.75).

Figure 8.75. Increase the name of each paragraph by one as you add them.


[View full size image]

5 .In the Define Database dialog box, type Include Paragraph 1 in the Field Name box, choose Text (Control+T/Command+T) as the field type, and click Create. This creates a field to use as a check box for choosing Paragraph 1.

6 .

Repeat step 5 to create as many check box fields as you just created fields for modular paragraphs.

In our example, we create a total of four text fields, named Include Paragraph 1 through 4 (Figure 8.76).

Figure 8.76. There should be as many Include Paragraph fields as there are Paragraph fields.


[View full size image]

7 .We need one field to contain the compiled text that the script creates. Type the document's name in the Field Name box, choose Text (Control+T/Command+T) for the field type, and click Create. Click OK to close the Define Database box.

In our example, we're building a contract, so our field name for the compiled text is Contract.


To create a template layout



1 .Choose View > Layout Mode (Control+L/Command+L).

2 .Choose Layouts > New Layout (Control+N/Command+N).

3 .

In the New Layout/Report dialog box, type a name for the layout in the Layout Name box and select "Blank layout" for the layout type (Figure 8.77). We named our example Contract Template. Click Finish.

Figure 8.77. Create a template layout to select and edit the contents of the Paragraph fields.


[View full size image]

4 .In the blank layout, drag the Header and Footer tabs up so they disappear, then drag the Body tab down to fill the window.

5 .Drag the Field tool onto the layout to bring up the Specify Field dialog box. Double-click Include Paragraph 1 in the field name list.

6 .Click the Include Paragraph 1 field on the layout.

7 .

Choose Format > Field Format (Control+Alt+F/Command+Option+F) to access the Field Format dialog box.

8 .

In the Style section, select Checkbox Set from the drop-down menu (Figure 8.78).

Figure 8.78. Use check boxes to tell the script which paragraphs to include.


9 .From the "Display values from:" drop-down menu, choose Define Value Lists (Figure 8.79).

Figure 8.79. You'll need to define a Value List for the check boxes.


10 .When the Define Value Lists dialog box appears, click New.

11 .

In the Edit Value List dialog box, type Y as the Value List Name, and type Y in the "Use custom values" box (Figure 8.80). Click OK.

Figure 8.80. This value list only needs a single value, Y.


The single value in the value list will be displayed in the layout as one check box.

12 .Click OK to close the Define Value Lists dialog box, then click OK to finish.

13 .In the layout, resize the Include Paragraph 1 field so that only the check box is visible (Figure 8.81).

Figure 8.81. You only need to see the check box for this field.


The check box field you've just created will allow you to include the first paragraph of text when the script runs.

14 .

Drag the Field tool onto the layout to bring up the Specify Field dialog box. Double-click Paragraph 1 in the field name list (Figure 8.82).

Figure 8.82. Add the Paragraph fields to this layout.


15 .Resize this field to fit the paragraph, then arrange the label, check box field, and Paragraph 1 field as you'd like them on the page (Figure 8.83).

Figure 8.83. Make the field large enough for the paragraph text.


[View full size image]

16 .Repeat steps 615 for as many paragraph fields as you created (Figure 8.84). Or see the tip that follows this section.

Figure 8.84. Add all of the Paragraph and Include fields to the layout.


[View full size image]

17 .Choose View > Browse Mode.

18 .

Enter the text for each paragraph of the document in their respective Paragraph fields. You can type this text in or paste it in from an existing text document. We now have a group of modular paragraphs that we can mix and match to create a customized document when we run our script.


Tips


Although you can add the check boxes and paragraph fields to the layout separately, frankly that's pretty tedious. It's faster to Shift-click the Include Paragraph 1 field, its label, and the Paragraph 1 field to select them all, then hold down Control (Windows) or Option (Mac) as you drag the mouse (Figure 8.85). Arrange the duplicated layout items below the first group in the layout. Double-click each layout item and select the next field name in the Specify Field dialog box to match the next paragraph (Figure 8.86). Remember to edit the paragraph numbers on the labels as well.

Figure 8.85. Control- or Option-dragging a field retains the size and formatting in the duplicated field.


[View full size image]

Figure 8.86. Select the next field name in sequence.


If you're creating a boilerplate document that people other than yourself might use, it's a good idea to add some instructions to the template layout (Figure 8.87).

Figure 8.87. Add text to explain how to use the layout.


[View full size image]

To create a layout for the compiled document



1 .Choose View > Layout Mode (Control+L/Command+L).

2 .

Choose Layouts > New Layout (Control+N/Command+N).

3 .In the New Layout/Report dialog box, type a name in the Layout Name box and select "Blank layout" for the layout type. Click Finish (Figure 8.88).

Figure 8.88. Select the Blank layout so you can create your own boilerplate template.


4 .In the blank layout, drag the Header and Footer tabs up so they disappear, then drag the Body tab down to fill the window.

5 .

Drag the Field tool onto the layout. In the Specify Field dialog box, uncheck the "Create field label" check box and double-click Label (Figure 8.89).

Figure 8.89. Don't add field labels, since this layout will be printed.


6 .

Control-drag (Windows) or Option-drag (Mac) the Label field on the layout to duplicate it. In the Specify Field dialog box, choose the field you created to hold your compiled document (Figure 8.90).

Figure 8.90. Double-click to specify another field.


[View full size image]

7 .Resize the fields to fit their text (Figure 8.91).

Figure 8.91. The fields need to be large enough for all of the text.


[View full size image]

8 .

Click the Text tool and add any additional text that you want to appear on the document when it's printed (Figure 8.92).

Figure 8.92. Use the Text tool to add instructions to the layout.


[View full size image]


To create a modular document script



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.

We use Create Contract, because that's what we're doing in our example.

3 .The Edit Script dialog box will appear. In the step list on the left, scroll down to the Navigation category and double-click Enter Browse Mode.

4 .

In the Navigation category of the step list, double-click Go to Layout. In the Script Step Options section, choose your template layout from the Specify drop-down menu (Figure 8.93).

Figure 8.93. The script will bring you to the template layout.


[View full size image]

When the script runs, this step will bring you to the layout we created in "To create a template layout" earlier in this section.

5 .In the step list on the left, double-click Pause/Resume Script.

This step pauses the script, allowing you to choose which paragraphs to include.

6 .

In the Field category of the step list, double-click Set Field. In the Script Step Options section, click the "Specify target field" check box. When the Specify Field dialog box opens, choose the compiled text field (in our example, Contract) by double- clicking it.

7 .If you want to include the name of a person from a database within the text, click the Calculated result: Specify button to bring up the Specify Calculation dialog box.

In our example, we're creating a contract, so we'll create a calculation to insert a name in the right place in the contract text.

8 .

Click the quotes operator. Inside the quotes, type your opening text (in our case, we use "This is a contract between"), followed by a space at the end of the phrase. Click to the right outside the quotes and then click the ampersand (&) operator button (Figure 8.94).

Figure 8.94. In a calculation, you put printable text in quotes.


9 .

In the field list on the left, double-click the Full Name field. Click the ampersand button again (Figure 8.95).

Figure 8.95. The introductory text will include the full name of the customer.


The Full Name field is a calculation field that combines the First Name, Last Name, and Middle Initial fields into one. See Chapter 4 for more on calculation fields.

10 .Click the quotes operator button and type and between the quotes. (There's a space before and after the and.)

After the space, we've typed the name of the company followed by a period to complete the typical contract phrase (Figure 8.96).

Figure 8.96. Type and with the name of your company in quotes.

[View full size image]

11 .Click to the right of the quotes, then click the ampersand button, the quotes button, and the paragraph button (Figure 8.97). Click OK to return to the Edit Script window.

Figure 8.97. The finished calculation combines the text entered with the contents of the Full Name field to create the opening paragraph of a contract.


This complex-looking field is just a text line that inserts a name from the database in the right place in a sentence.

12 .In the step list on the left, double-click If. In the Script Step Options section, click Specify.

13 .In the Specify Calculation dialog box, double-click the Include Paragraph 1 field.

14 .Type ="Y" and click OK (Figure 8.98).

Figure 8.98. If the Include Paragraph field is checked, the contents of the field are actually Y.


15 .In the step list on the left, double-click Set Field.

16 .

In the Script Step Options section, click the "Specify target field" check box to bring up the Specify Field dialog box, then double-click Contract in the list.

17 .In the Script Step Options section, click the Calculated result: Specify button to bring up the Specify Calculation dialog box. Double-click Contract in the field list on the left.

18 .Click the ampersand button, then double-click the Paragraph 1 field (Figure 8.99).

Figure 8.99. The contents of the Paragraph field will be added to the field holding the compiled text.


19 .Click the ampersand button, then the quotes button. Click between the quotes and then click the paragraph button (Figure 8.100). Click OK to return to the Edit Script window.

Figure 8.100. You add a paragraph marker to space down to the next paragraph.


This If step adds the first paragraph if you check it in the template layout.

20 .

In the script-assembly list, click the If step, hold down the Shift key and click End If. Click the Duplicate button (Figure 8.101).

Figure 8.101. Duplicating the steps is easier than adding them manually.


[View full size image]

21 .Double-click the duplicate If step. When the Specify Calculation dialog box appears, change the 1 to 2, then click OK.

22 .Click the duplicate Set Field step. In the Options section, click Calculated result: Specify. When the Specify Calculation dialog box appears, change the 1 to 2, then click OK (Figure 8.102).

Figure 8.102. Change the number to indicate the second paragraph.


23 .

Repeat steps 2022 for as many additional paragraphs as you created. In our example, we do this for numbers 3 and 4 (Figure 8.103).

Figure 8.103. Add and modify a set of Ifs for each paragraph in the contract.


24 .

In the step list on the left, double-click Go to Layout. In the Script Step Options section, choose the layout for the compiled document (in our case, Contract) from the Specify drop-down menu. Click OK twice to finish.

When you run the script, it goes to the template layout and waits for you to make choices. It finishes by switching to the second layout, where it compiles your choices into a text document. You can make additional changes to the text before printing.



/ 227