Report parameters
Products: FastReport Cloud, FastReport Corporate Server, FastReport Publisher
This article covers the process of passing parameters to a report, which are a dictionary of parameters provided when generating a report. More information on this can be found in the FastReport .NET guide in the Report parameters section.
Getting started
You will need the following tools and facilities:
Know how to use API key in Service solutions.
This article will skip over additional information on authentication and authorization.
C# code editor or text editor, e.g., Visual Studio Code.
Report template.
It can be generated in the free FastReport Community Designer program.
Active subscription to one of the following products: FastReport Cloud, FastReport Corporate Server, or FastReport Publisher.
Internet access.
Important! These guides assume that you already know how to develop your application in the C# programming language.
Note. The items above describe recommended tools.
Pass parameters to the report
Parameters can be passed when:
- preparing a report;
- exporting from a template;
- working with tasks.
Let’s consider parameter passing by example of report generation. Detailed instructions on how to create a report can be found in the Create report section.
public async Task PassingReportParameters(HttpClient httpClient,
string folderId,
string templateId,
string fileName)
{
ITemplatesClient templatesClient = new TemplatesClient(httpClient);
PrepareTemplateVM task = new PrepareTemplateVM()
{
Name = Path.ChangeExtension(fileName, ".fpx"),
FolderId = folderId,
ReportParameters = new Dictionary<string, string>
{
{ "Parameter1", "Value1" },
{ "Parameter2", "Value2" }
}
};
// Add new parameter to dictionary
task.ReportParameters.Add("Parameter3", "Value3");
ReportVM result = await templatesClient.PrepareAsync(templateId, task);}