Create a report template from an existing report

You can reuse the content from your report by using that report as a basis for a new report template.

You have an existing report, and you want to use it as the basis for a new report template. When you have finished, you must add the new templates to the Designer Wizard.

Before you begin:
  • Have a new directory on your disk (e.g: My Report Templates) where you will store the report template files that you create in the following procedure. If you have not set up a template directory, see Set the report template directory.
  • Have an existing report.

  1. Create a copy of your report design (.4rp) and save it in your report templates folder.
  2. Rename the copy to a different name, and with a .4rt extension.
    It is recommended that you not have a .4rp and .4rt sharing the same name in a template folder. If your report is names SalesList.4rp, you would not simply name it as SalesList.4rt. You would modify the name in some manner; for example, you can add the word Template to the name and save it as SalesListTemplate.4rt.
  3. Open the .4rt file in Report Designer and examine the report. In the next step, you must identify which fields are variable placeholders and which parts are template fields.
  4. Create a report schema template definition (.rsd).
    Rather than starting with an empty file, it is recommended that you take an existing report data schema (.rsd) file from the templates provided during the installation and modify it to meet your report needs. You can find report schema template definitions (.rsd) in $GREDIR/gre/templates.
  5. Return to your .4rt file, to the Data View tab, and change the schema to the schema you created in the previous step.
    You are not going to use the actual data fields anymore, you are going to use the fields from your template schema. In the Design View, the places where you had data fields (from the original report) are now marked as errors.
  6. For the variable placeholders, double-click on each error to display the Edit Expression dialog. Replace the value with one of the names from the template schema file.
  7. For the row of fields, such as those contained within a Table Row container, you must replace the fields with a Template Field placeholder.
    1. Delete the existing fields.
    2. Go to Tool Box.
    3. Drop the Template Field onto the Table Row (or similar container).
    4. In the Template Field section in the Properties view, the Name, Type, Size, Title and Role properties should be preset.
      When you drag something from the Data View into the Document View, it creates an object based on the context of where it is being placed. These five properties provide the information needed to create the correct object. This field is repeated as many times as needed.
  8. Replace any column headers with a Template Field.
  9. In the Report Structure, organize the TemplateField objects to sit under the fields triggers.
    Right-click on a TemplateField, select Repeat selected items on, then select the template fields trigger.
    Tthe template is now finished.
  10. Create a copy of a .prop file, and modify the contents of the file for your new template. Give the copy the same name as the template file.
  11. Create a template image (.4rt.png) to serve as the image displayed in the Report From Template selection list. Save it with the same name as the template file.
  12. Create a empty image directory for the new template, with the same name as the template file.
    Eventually, you will provide an image for each of the placeholders. This can be done at a later time.
  13. Select Tools > Specific setup > Reload.

The new template is available for use.