2.4Parameters & prompts
The essentials in 30 seconds
- Parameter = value asked at runtime: name, clear prompt, type — the report adapts to the input.
- Use #1 = filtering: the parameter feeds selection — one template for all years and regions.
- List + default + server: value menu, current value pre-filled, database-side filter — guided, fast, error-free.
Running mini-case — Farès and the twelve copies of the same report
Farès maintains one copy of his report per year and per region: twelve near-identical files, every fix to repeat everywhere. He creates a Year parameter (prompt “Select the year”, number type, 2024-2026 list, 2026 default) and a Region parameter (value list), then plugs them into his selection: the user picks at runtime, one template serves all cases. He even shows the chosen year in the title (“2026 Sales — North”). In 2.5, he will add a “Show detail?” parameter to switch summary/detail without duplicating the report.
Thread continued from 2.3: Farès's frozen filter becomes interactive — and continues in 2.5.
1. A value asked at runtime
A parameter is a value Crystal Reports asks the user for when running the report (“Which year?”, “Which customer?”, “Minimum amount?”). The user types or picks a value, and the report adapts. You create a parameter in the field explorer (“Parameter Fields → New”): give it a name, a prompt — the displayed text: “Select the year” — a type (number, text, date, boolean…) and options (single or multiple value, value list, default value). Farès creates {?Year} and {?Region} for his sales report.
2. Use #1: filtering
The most common use: the parameter feeds record selection (2.3) — e.g. “Order date in year {?Year}” — to show only the picked data. A single report thus serves all years, all customers, instead of one report per case. Other uses: displaying the picked value in the report (“{?Year} Sales — {?Region}”) to title from the input, or driving formulas and formatting (level 3). Farès replaces his hard-coded 2026 with {?Year}: the 2025, 2026 or North, South report comes from the same template.
3. Options and best practices
Key options: multiple values (pick several customers at once, “in the list” filter), range (between two dates), value list (drop-down menu: static, or dynamic fed by the database — level 5), default value, optional parameter. Parameters combine (year AND region AND threshold). Best practices: plug the parameter into the filter while staying server-side (performance, 2.3); word the prompt carefully (clear text); offer a value list when possible (avoids input typos “north” vs “North”). Farès lists regions and pre-fills the current year.
🔎 Concrete example — 🔎 Hands-on example — One template for all years
Farès's report, from frozen value to parameter:
Before (hard-coded): Year({Commandes.DateCommande}) = 2026 → one report per year.
After (parameter): Year({Commandes.DateCommande}) = {?Year}
and {Clients.Region} = {?Region} → the user picks; one template.
Reading: the parameter replaces the hard-coded value in the selection formula.
Lesson: offer a value list + a default value to guide input.
Section vocabulary
- Parameter
- A value ASKED from the user at runtime (year, customer, threshold); the report adapts to the input. Created in the explorer (Parameter Fields).
Simple example: Farès creates {?Year}: the user picks 2025 or 2026 at runtime.
What it is not: a hard-coded frozen value in the filter.
Reflex: multiple cases = parameter, not copy.
- Prompt
- The text shown to the user to enter the parameter (“Select the year”); to word clearly.
Simple example: Farès's prompt says “Select the year”, not “Param1”.
What it is not: the parameter's internal technical name.
Reflex: prompt = clear action sentence.
- Filtering parameter
- The most common use: the parameter feeds RECORD SELECTION to show only the picked data.
Simple example: Farès's selection uses {?Year} and {?Region} instead of fixed values.
What it is not: a parameter created but never wired.
Reflex: parameter = wired to selection.
- Parameter options
- Type, single/MULTIPLE value, RANGE, value LIST (static or dynamic), DEFAULT value, optional.
Simple example: Farès allows several regions and pre-fills the current year.
What it is not: an obscure free input with no guide.
Reflex: list + default first.
In practice — Hands-on — Create interactive parameters
- Create a parameter (explorer → Parameter Fields → New): name, clear PROMPT (“Select the year”), type, options (single/multiple, range, value list, default).
- Plug it into RECORD SELECTION (“Order date in year {?Year}”) — staying server-side if possible.
- Optionally show the picked value in the report (“{?Year} Sales — {?Region}” title).
- Test at runtime: the prompt appears, you type/pick, the report adapts. One template serves all cases.
Ready-to-say script — selling the single template (30 s)
“No more twelve copies: one sales report, with two questions at launch — the year and the region. You pick, the report filters and titles accordingly. Fewer files, a single fix to make, and no input typos thanks to lists. Try it: run it for 2025 North then 2026 South.”
Say while running Farès's report twice with two value pairs, titles as proof.
Copy-paste template — parameter-driven selection
Year({Commandes.DateCommande}) = {?Year}
Year({Commandes.DateCommande}) = {?Year} and {Clients.Region} = {?Region}
{Commandes.DateCommande} in {?DateRange}
{Clients.Ville} in {?Cities} // multi-value parameter
Date range
Farès offers a 01/01 to 12/31 range: the user enters two bounds for the period.
Several customers
Multi-value parameter: Farès picks three customers at once, “in the list” filter.
Amount threshold
Threshold parameter with 1,000 default: Farès keeps only significant orders, changeable at runtime.
Obscure prompt
“Param1:” prompt: nobody knows what to type — Farès rewrites it as “Select the region”.
✓ Best practices
- Offer a value list (drop-down menu) rather than free input.
- Provide a sensible default value (the current year).
- Plug the parameter into the filter while staying server-side (performance).
✗ Common pitfalls
- Free input causing typos (prefer a value list).
- A parameter not wired into the filter (the report does not adapt).
- An obscure prompt that confuses the user.
Key takeaways
- A PARAMETER is a value asked from the user at runtime via a PROMPT; the report adapts.
- Use #1: FILTERING — the parameter feeds selection. A SINGLE report serves all cases (generic, reusable).
- Options: MULTIPLE values, RANGE, value LIST (static/dynamic), DEFAULT value. Parameters combine.
- Best practices: stay SERVER-SIDE, word the PROMPT carefully, offer a value LIST. Can also title the report.
48h challenge — apply tomorrow
On your hard-coded filtered report: create a parameter (clear prompt, list, default), wire it to selection, show it in the title, then test 2 different values at runtime.
- I can create a parameter (name, prompt, type, list, default).
- I can wire it to selection (adapting report).
- I test at runtime with several values (reusability proven).
Frequently asked questions
How does a parameter make a report reusable, and how to filter with it?
Without a parameter, a hard-coded filter (Date in 2026) forces you to edit or copy the report for each case. A parameter is a value asked at runtime: the user picks, and the report adapts — one template serves all cases. To filter: (1) create the parameter (explorer → Parameter Fields → New: name, prompt, type, options); (2) plug it into record selection by replacing the hard-coded value: “Year({Commandes.DateCommande}) = {?Year}”. At runtime, the prompt appears and the report shows only the picked year. Best practices: stay server-side, offer a value list, a default value, and show the picked value in the title.
Which parameter options for a good experience?
Pick the right type (Number, Date, String, Boolean). Single value for one pick; multiple values to pick several (“is in the list” filter). Range for an interval (“between two dates”). Value list (static or dynamic — fed by the database) to guide and avoid typos: it is the option that most improves the experience. Default value for the common case; optional parameter for a facultative filter. Write clear prompts. Prefer value lists over free input, and cover real needs (multiples/ranges) without multiplying runs.
What is a parameter mainly for?