Creating a report from scratch is a lengthy process, and while FlexReport Designer reduces the amount of code you need to write, you still have to walk through all the individual steps. That’s where Report Wizard comes in: for simple reports, you can easily step through the tabs and have a finished report in no time. For more complex reports, the basics are covered and you can focus on the more complex tasks. Let’s look at the individual components of a report.
- Connection string: The connection string tells the report what kind of data provider you’re referencing, and the name of the database.
- Data Provider: Your data can exist in SQL Server, Access, XML, etc.
- Database: Your organized set of data
- Table, View, or Stored Procedure: The data you’ll be accessing in your report may come from a single table, a view, or a stored procedure in the database.
- Database fields: These reference the data you’ll be displaying in your report, and they’re named in the table, view, or procedure.
- Grouping fields: These optional fields allow you to group and organize your data.
- Layout arrangement: Will your report be tabular, columnar, justified, or a set of labels? Will it be portrait or landscape?
- Theme: Theme covers the visual elements of the report, including font, color, font size, headers, etc.
Coding these items manually would be a long, unnecessarily tedious process. The Designer will go a long way in assisting with layout and themes, but when you’re creating a basic report and know the answers to these questions at the start, the Wizard allows you to deploy a full report in only 5 steps.
Open the FlexReport Wizard
- Open the FlexReport Designer AppC:\Program Files\ComponentOne\Apps\v4.0\C1FlexReportDesigner.exe
- Click File > New.
- In the Reports Tab, click New Report > Report Wizard.
Step 1: Build your connection string.
Choose your data provider from a list of available providers and set the path to your datasource and click Next. Select the data provider. Select the database. Choose the table, view, or stored procedure, and then click Next: Select the datasource. The data provider was easy to choose; the connection string is automatically set, with no manual coding; and all tables, views, and stored procedures are listed in a single window. Alternately, you can provide a SQL Query on your own, if you want data from multiple tables, or have any special requirements: Write a SQL query.
Step 2: Select the fields to display in the report.
This step's greatest advantage is that you can set grouping at a very early stage of report design. As you make additional edits in the Designer, your groups and details will be clear. Simply drag the fields from Available to Groups and Detail. Select data fields to display. Select a grouping field.
Step 3: Select the report's layout.
Basic, ungrouped reports have three layout options:
If your report needs grouping by a field, you'll get more options:
Let's choose a report grouped by CategoryID. Good news: you're 90% finished!
Step 4: Select a theme.
Step 5: Name your report.
Name your report. That's it! Now you can view your report in Preview: Preview your report. The report you see is ready to use. The Header and Detail sections are automatically styled and distinguished; groups are well-identified; the layout of the report is neatly arranged; and the theme is attractive. If you have further requirements—such as adding calculations to your report—you can go back to the Design View and modify the report. For more information on FlexReport features, refer to FlexReport for WinForms documentation.