Skip to main content

How To Pass a Parameter Through a TierButton

Overview

This article explains how to run a report on one record or select a parameter on a document by passing the parameter for a Crystal Report through the TierButton.

Run a Report on One Record

Use this method to run a report on one record by passing the parameter for a Crystal Report through the TierButton.

General Process

  1. Create the Crystal Report with a parameter.
  2. Add a TierEdit and TierButton to the form.
  3. Create the FD table by saving the form as a document.
  4. Create a new report category if needed.
  5. Create the report.
  6. Set the Params property for the button.

Steps

Complete the following steps.

1. Form Controls

Place the following controls on the form.

Control Property on Object Inspector Value
TierEdit FieldName test
  Name test
  Calculation :tier_docid
  Fieldtype integer
  Fieldsize 0
TierButton Params Parameter name=:test
  Action baReport

NOTE: For TierButton, In Design View on the Object Inspector, click the Params property. Click the ellipsis and add the parameter name=:control name here. The parameter name is the name of the parameter in Crystal Reports without the “?” preceding it. There are no spaces before or after the equal sign in Params.

2. FD table

Once the controls are on the form, save it as a document in a cabinet to create the FD table.

3. Report icon
  • If needed, create a new report category by right-clicking the report icon and selecting New Report Category.
  • Create a new report by right-clicking the report category and selecting New Report.
    • Fill in name.
    • Click on run Tool to open Crystal Reports.
4. Create report
  • Insert the fields on the report.
  • Create and insert the parameter.
  • Select the parameter in Select expert.
  • Save the report in the report directory on the server.
  • Close the report.
  • Click Browse to select the location of the report. The path will appear next to Report File.
5. TierButton

Connect the report to the button by setting the following property in Design View.

Control Property on Object Inspector Value
TierButton Report The report name
  Caption Run Report

NOTE: The report name refers to the name of the Crystal Report.

Select a Parameter on a Document

Use this method to pass only one parameter for a Crystal Report through the TierButton.

General Process

  1. Add a TierComboBox and TierButton to the form.
  2. Create the FD table by saving the form as a document.
  3. Create a new report category if needed.
  4. Create the report.
  5. Set the Params property for the button.

Steps

Complete the following steps.

1. Form controls

Place the following controls on the form.

Control Property on Object Inspector Value
TierComboBox FieldName P_List
  Items List of the parameter defined in Crystal Reports
TierButton Params Parameter name=:tiercombo
  Action baReport

NOTE: For TierButton, the parameter name is the name of the parameter in Crystal Reports without the ? preceding it. For example, :tiercombo refers to the control name of the TierComboBox that has the parameter list. There are no spaces before or after the equal sign in Params.

2. FD table

Once the controls are on the form, save it as a document in a cabinet to create the FD table.

3. Report icon
  • If needed, create a new report category by right-clicking the report icon and selecting New Report Category.
  • Create a new report by right-clicking the report category and selecting New Report.
    • Fill in name.
    • Click on run Tool to open Crystal Reports.
4. Create report
  • Insert the fields on the report.
  • Create and insert the parameter.
  • Select the parameter in Select expert.
  • Save the report in the report directory on the server.
  • Close the report.
  • Click Browse to select the location of the report. The path will appear next to Report File.
5. TierButton

Connect the report to the button by setting the following property in Design View.

Control Property on Object Inspector Value
TierButton Report The report name
  Caption Run Report

NOTE: The report name refers to the name of the Crystal Report.