Progress
Report Builder
Tutorial
Preparing the Memo File
The first step in generating a form letter is to prepare the memo file, which is an unformatted text file that contains the text for the letter. Unformatted means that the file does not contain format information from the text editor or word processing program in which you created or edited the file. When you save a file with some text editors or word processing programs, the programs save formatting codes at the beginning of the file even if you do not specify any formatting information, such as fonts or styles. To save a file without any formatting information, you must save the file as a text-only or unformatted ASCII file. If the memo file contains any format information, Report Builder cannot use the file.
Figure 6–2 shows the text in the unprepared memo file,
Formlet1.txt
, which contains the text for the form letter recalling defective merchandise. This file provides the main text for the Recall form letter.
Figure 6–2: Unprepared Recall Memo File (Formlet1.txt)
This text comprises a memo field. A memo field is a portion of text that you include in the report layout. You can combine this text with data from fields in a database. In Figure 6–2, the phrases in parentheses indicate the information you will access from the Newsport database.
Before you can use the
Formlet1.txt
memo file in a report, you must perform the following steps to prepare the memo fields in the text file:Figure 6–3 shows a properly annotated memo file named
Recall.txt
.
Figure 6–3: Prepared Recall Memo File (Recall.txt)
Follow these steps to properly annotate the memo file:
- Open
Formlet1.txt
in an editor or word processing program that allows you to save the file as an unformatted text file or ASCII file. This file is located in therbtutor
directory.- Enter the following line on the first line of the memo file to identify the memo field as “Recall.” You must enter it on a separate line before the text, starting in the first column:
Because there is only one memo field in this memo file, you only specify one memo field name. Memo field names must be unique within the memo file. Memo field names follow the same rules as 4GL field names. Field names can be up to 32 characters long and can consist of alphabetic characters (A–Z or a–z), digits (1–9), and special characters ($, &, #, %, -, and _). In addition, field names must begin with a letter (A–Z or a–z). The memo field name must also be unique within a report that uses the memo file and cannot contain spaces.
- Mark the beginning and end of the memo field with braces. Use the left brace, {, to mark the beginning of each memo field and a right brace, }, to mark the end. The left brace must be the first character on the line that follows the memo field name. In Figure 6–4 note the braces indicating the beginning and end of the memo field.
Figure 6–4: Memo Field Identification and Beginning and Ending Braces- Include database or user-defined field names in the text of the letter to merge data from the tables into your memo field text. These fields are called embedded fields. When you insert the memo file on the report layout and generate the report, Report Builder inserts the proper data from the embedded fields into the memo field text. The
Formlet1.txt
file has place holders, such as “(customer name)”, in the text that indicate what fields to include and where to insert the field names:
- Replace “(customer name)” in the opening salutation with {@Contact}. The braces and @ sign notify Report Builder that the enclosed text is a field name that it will replace with data from the Newsport database.
- Replace “(item name)” once in the first paragraph and two times in the second paragraph with {@Item–Name}.
- Replace “(item–number)” in the first paragraph with {@Item.Item–num}. Because the field Item-num appears in more than one table in the Newsport database, you must precede the name of the database field with the table alias.
Figure 6–5 shows how to include the customer contact name, the item name, and the item number from the Newsport database in the memo file for use in the recall form letter.
Figure 6–5: Embedded Field NamesWhen you include this memo field in your report, the customer contact name replaces {@Contact}, the item name replaces {@Item–Name}, and the item number replaces {@Item.Item–num}.
- Save the prepared file as Recallet.txt using a “Text” or “Text Only” option for saving unformatted text files.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |