Tutorial 8 - Building a Report Procedure

You will build two Report Procedures (the WHAT portion of the Report Builder) that will retrieve Name and Address data from the Name table and format it to fit the Label Print Template just created. In Exerccise 8-1 you will build a Procedure that uses the Start Entry object; in Exercise 8-2 you will copy the Procedure and modify it to use the Parameters object as its entry point. Instructions are limited and you are expected to create the Procedure by following the examples given



Exercise 8 - 1, Creating a Report Procedure
The Procedure starts out by priming up twelve Variables as text strings plus one Variable as a counter. It then determines whether or not the Salutation and First Name fields, of the retrieved data, should be included in the formatted Name print-line of the Label. To make things more interesting, we assumed that addresses located in the USA have the ZIP code printed in the same Address print-line as City and St/Pr whereas all other countries print the Zip (Postal Code) on a separate line. And finally, we track the label Count to determine the appropriate time to invoke the Print instruction (every second label, with the exception of when we have exhausted all Name and Address records, at which time a single label may have to trigger the Print instruction). The finished Procedure will look like this:

This Procedure uses no Parameter input and will print the entire content of the Name table. This is, however, an application where Parameter input might be desirable to establish various Search Criteria (using the Search Key option) to permit selection by ranges or specifics based on Entity, Name, City, etc. fields. Also, in a commercial setting, it might be desirable to specify a Sort Order based on the Zip code. Let's create an identical Report Procedure with the exception that we will replace the Entry (Start) object with a Parameter box holding four parameters.


Exercise 8 - 2, Copy and Modify the Report Procedure
Create a copy of Labels2up by selecting the Save As... menu item and giving it the name Labels2upSelective.

Move the objects in the Workspace down to make room for the Parameter object with four fields.

Select the Entry/Start object and delete it.

Drag a Parameters object from the Palette into the Workspace and click on the bottom center Control Point and drag down until a total of three fields are shown in the Get Field area.

With the Parameters object selected click four times on New parameter in the Palette.

This will populate the four fields with par1, par2, par3, and par4.

Rename the four Parameters as Entity, Name, City, and State; leave the default data type as Text.

Select the Retrieval object and drag the applicable fields in the Inspector's Search Criteria to the top (Drag fields above this line), set the run-time buttons to ON (center is gray), select Search key from the Comparison Operators pop-up list, and drag the appropriate Parameters from the Palette's Local Resources into applicable Search Criteria fields:

On running the Label report live or in Test Mode, you will be asked to specify the Search Criteria Parameters. By specifying not equal (!=) and leaving the fields empty, you will retrieve the entire content of the table; or, if you want to limit the retrieval, select appropriate Comparison Operators from the pop-up list and enter the applicable parameter data into the editable fields:

          

Follow these instructions to create the procedure with a simple Start object:

1. Launch Report Procedures editor.
You will see the three configuration windows: Palette, Workspace, and Inspector.

The Workspace comes pre-loaded with a Parameters and Finish object. If more than one parameter input is required, you can expand (or contract) the object by selecting an upper or lower control point and dragging it. If no parameter is required, delete the Parameters object and replace it with the Entry/Start object from the Palette. This exercise makes use of no parameters.

2. Select the Parameters object and press the Delete key on the keyboard.
Drag the Entry/Start object from the Palette and drop it into the Workspace.
3. Drag the Calculation object from the Palette and drop it into the Workspace to the right of the Start object and resize it to accommodate the twelve (12) variables indicated in our example.
4. With the Calculation object selected in the Workspace, click on New variable in the Local Resources area of the Palette.
This will load var1 into the Calculation object and into the Local Resources.
Complete the Calculation instruction by adding = ' '; behind var1.
These instructions may be typed, which should then be followed by clicking on the Return key to obtain the desired line feed; however, if the semicolon is mouse-selected from the Palette's Operators and dividers, the line feed is automatic.

Repeat the process until you reach var12.

5. Deselect the Calculation object and rename the variables var1 - var12 as per our example.
6. Drag another Calculation object into the Workspace and load another variable, priming it as a counter (var 1 = 0) and naming var1 as Count.
The generic descriptions always start with var1 unless other generic var descriptions have already been named in which case the incremental count continues as it did as part of instruction #4.

7. Drag the Retrieval object from the Palette and drop it into the Workspace below the Start object .
With the Retrieval object selected, click on the bottom center control point and drag down until eight (8) fields are visible in the Get Field area.
8. Click Name under Sources in the Palette followed by clicking on all the field names you wish to retrieve.
This will populate the Retrieval header and the eight Get Field fields.
9. The Retrieval and the Search view of the Inspector need not be modified; however, select the Sort tab and drag Country and Name above Drag fields above this line and leave the default ascending settings (arrow up, do not click on the arrows other than for testing):

10. Drag the Next row ? conditional object from the Inspector's Row Processing view and place it below the Retrieval object.
Flip the Yes /No Exit orientation of the Next row ? conditional object to No/Yes by clicking on the lower image in the Inspector (displayed when the Next row ? conditional object is selected).
11. Complete the rest of the Procedure as per example. Pay close attention to the Exit orientation of the Condition objects.
Please Note: when dragging the Print object into the Workspace, the Palette's default view will be replaced with the Print templates view. At this stage it will have a single option: Labels. Single-click the name Labels to view the format. Double-click it to load the name into the Print object and observe the change in the Inspector's view:

The Labels column shows the field names used in the Labels template. The Local vars column is used for manual or automatic mapping. If the variables of Procedure are identically named, then mapping is automatic upon engaging Check syntax or Save. If identical naming conventions are not observed, then the applicable Procedure names can be dragged from the Palette's Main resources and dropped into the proper field slot.

12. Check syntax, if an error was made you will see a message like this:

13. Connect the objects in the order of execution, as per our example, Save the Procedure, and Test.
The Test window will be displayed, click on the Step button in succession and observe the progress. In the Workspace the test progress will be indicated by placing a box border around the object currently being executed and the Execution trace of the Test window will spell out exactly what is happening, including the generated SQL commands, when applicable:

      

On completing the Test Step by Step (or Run) process, switch to the Test window's Report preview option and see the finished result.

Go To
  Tutorial 9 - Creating a Form Letter
  Index