Glossary Item Box
Use the Parameters dialog to prompt the user for input when reports are generated.
Add <%FieldName | PromptString | DefaultValue | Type%> to the SQL string for the report to display the Parameters dialog.
Note: For Strings, if you specify a default value that is enclosed in apostrophes or quotation marks, ActiveReports sends the same marks to SQL. For Boolean parameters, if you specify true/false for the DefaultValue it generates true/false for SQL output. If you specify 0,1, it generates 0 or 1.
Example: The SQL statement "SELECT * FROM products INNER JOIN categories ON products.categoryid = categories.categoryid WHERE products.supplierID =<%SupplierID|Enter supplierID|1000%> and OrderDate=#<%Date|Order date:|1/1/2001|D%># and Discount='<%bool| Is this checked ?|true|B%>'" yields a dialog which looks like this:
Note: FieldName is the only required parameter; the rest are optional. But note that if you do not specify a default value, the field list is not populated at design time.
You can use stored procedures in the same way as parameters in ActiveReports. The Sql statement has the stored procedure call and placeholders for the parameters: "CustOrderHist '<%ID|Enter Customer ID:|AFLKI%>". ActiveReports replaces the parameter text "<%...%>" with whatever the user types into the dialog to create a call like this: CustOrderHist 'AFLKI'.
You can use parameters with subreports to connect the subreport to the parent report. If you set a parameter for the field that links the parent report to the child subreport, the parent report passes the information to the child through the parameters. Keep the following in mind when working with subreports and parameters:
Note: Both report queries must contain the same field (so the main report must have a categoryID field and the subreport also must have a categoryID field.
See Also |
Walkthrough: Using Parameters with Simple Reports | Walkthrough: Using Parameters with Subreports
Copyright © 2004-2005 Data Dynamics, Ltd. All rights reserved.