fyiReporting reports tutorial 1/2

16 Jan

Part 1/2 (Intro)
Part 2/2 (Paramters)

If you want print in WPF please view my new WPF-Printing Library

I will upload some pictures for better understanding next week

In consideration to my administration program, I was forced to choose between several reporting engines. Finally, the decision was to use FyiReporting. Its an open source solution to generate rdl-Templates.

Beginning with the designer

The first step should be to use the designer to design the report as is should be. You can download it from the project homepage. The main window of the designer is divided into three parts. The page header, body and the footer.
The header and the footer is used for information of that e.g a bill is consisting: the recipient of the bill on the top of the page, the sender ont the bottom. The body is used to list the items of the bill.

DataSet – Containing all information that is shown in the body of the report

The major point is the DataSet in which you can load the corresponding data from outside. It contains the information about what kind of data is loaded from the final XML-file.  Before creating a DataSet you have to add a Data Source by clicking Data=>Data Sources. There you can select the database you want to use, etc.  To not use a database you select one of your choice and enter following connection string data source=localhost;initial catalog=Name. A new DataSet is created by selecting the Data=>Data Sets=>New menu item. There you should select the created DataSource. By adding items in the “Fields” box you can add this columns you want to be shown in the report. Be aware to scroll to the right to set the “TypeName”. Each TypeName should be in the form of  System.String, System.Int32, System.Decimal.

After creating the DataSet you should make a table in the body. The table can be created by choosing the corresponding table icon in the tool-bar of the program. A new window opens. There you can select the DataSet you want to use.  Select all appearing columns that you want to use in the report.

After that the table is shown in the body. Some of the cells of the table contains values like “=Fields!ColumnName.Value”. The “Fields” are the values in the dataset.

Now some basic steps of the report are done.

The next steps were realized via C#

private void loadReport()
        ReportViewer reportViewer = new ReportViewer();
        reportViewer.ProcessingMode = ProcessingMode.Local;
        reportViewer.LocalReport.ReportPath = @"PathToReport\report.rdl";
        ReportParameterInfoCollection re = reportViewer.LocalReport.GetParameters();
        reportViewer.LocalReport.DataSources.Add(new ReportDataSource("DataSetName", loadXML()));
        windowsFormsHost.Child = reportViewer;
    catch (Exception ex)

private DataTable loadXML()
    // Load data from XML file
    DataSet dataSet = new DataSet();
    dataSet.ReadXml(new XmlNodeReader(/*Takes Some XML-File*/));
    return dataSet.Tables[0];

private ReportParameter loadReportParameter()
    ReportParameter parameters = new ReportParameter[2];
    parameters[0] = new ReportParameter("ParameterName1", "VALUE");
    parameters[1] = new ReportParameter("ParameterName2", "VALUE");
    return parameters;

To generate the corresponding XML-File following code can be used

private void GenerateXML( BillItem[] billItem )
    //BillItem is a class that I have creaded. You can use your own class to store the bill-items into your C# code
    XmlDocument xmlBill = new XmlDocument();
    XmlNode docNode = xmlBill.CreateXmlDeclaration("1.0", "UTF-8", null);
    XmlNode productsNode = xmlBill.CreateElement("SomeName1");
    productAttribute.Value = "http://someURL/SomeName1.xsd";
    foreach (BillItem item in billItem)
        if (item == null) break;
        XmlNode productNode = xmlBill.CreateElement("DataSetName");
        XmlNode nameNode = xmlBill.CreateElement("ColumnName1");
        nameNode = xmlBill.CreateElement("ColumnName2");

An example of a fyiReporting Designer report file can be downloaded here
Note: change the file extension of the file from .doc to .rdl to be able to view the file with fyiReporting Designer.


Posted by on January 16, 2010 in C-Sharp, Printing, Reporting



13 responses to “fyiReporting reports tutorial 1/2

  1. baer999

    February 1, 2010 at 06:58

    this very nice Tutorial helps me a lot.
    but I still got a question: How do you create your template rdl Files, that are representing the layout for the printed out documents? Which app can you suggest? Thx

    • michaelmairegger

      February 1, 2010 at 08:16

      Because I had to chose an Open Source solution for my project my decision was to use fyiReporting as rld-template designer.

  2. any

    May 6, 2010 at 19:10

    Hello I am starting with fyireporting but not very clear to me what parameters, I explain I have a report already designed but has a parameterized query and what, I need is that on my form to add the values and run the report

  3. michaelmairegger

    May 7, 2010 at 09:45

    The parameter I used in the example are not equivalent to the parameters that are used in a SQL-query. Here the example are used to write dynamic strings into the header and footer.
    But you can send a SQl-Query to the report,the report viewer handles the querie and feeds the report with the received data from the server.

  4. Any

    May 7, 2010 at 14:42

    you can give me a small example, to better understand, actually makes me a little complicated.

  5. michaelmairegger

    May 12, 2010 at 07:28

    I have uploaded an Example .rdl file for the fyiReporting Designer. I will write some explanation in the following days

  6. victoria-ro

    May 19, 2010 at 09:05

    Thank you for that informative post. I really love to read articles that have good information and
    ideas to share to each reader. I hope to read more from you guys and continue that good work that
    is really inspiring to us
    mesin air minum

  7. Rodnei Silva Couto

    December 8, 2011 at 02:43

    Hi, Can you give us a functional solution to open in VB Studio? Where do you find a good tutorial about fyiRporting?

    • michaelmairegger

      December 8, 2011 at 20:23

      what do you exactly mean with VB-Studio?
      The rdl file is an XML stuctured file that has to be loaded in a reporting viewer.
      You can open the rdl file with the fyiReporting designer.
      Unfortunately, I no longer use the fyiReporting tools and accordingly have no further tips.

  8. Rodnei Silva Couto

    December 8, 2011 at 22:24

    i meant visual studio, i’m a newbie in dot net.
    I need a simple way to generate a report using I can`t find an easy way to integrate fyiReport with asp net.

    What do you recommend now?


    • michaelmairegger

      December 10, 2011 at 13:04

      unfortunately I do never worked with ASP.NET. But according to the information on the fyiReporting webpage they do support ASP.NET.
      I think it will work exactly like in C#.

  9. rani irsan

    August 18, 2015 at 11:12

    Do you know how this works with mysql. I’ve tried but always got this error:
    Unable to open connection
    Could not load file or assembly ‘MySql.Data.dll’ or one of its dependencies. The system cannot find the file specified.

    • Michael Mairegger

      August 29, 2015 at 11:56

      This error is no mysql specific error, it indicates you that ‘MySql.Data.dll’ is either not found on your system or it is not referenced by your project.


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: