FastReport Designer and adding datasource
Is it possible to add custom datasource (e.g. business object) using FastReport Community designer so I can first design report template and later in code register and use data? Is there any example how it can be achieved? Thank you
Same problem here
It depends on which data source you're using. E.g., for SQL Server, you can add an MS SQL Connection in the community designer, design and test your report. Then, in your code, load the template and modify the connection
report.Report.Load(template);
report.Dictionary.Connections[0].ConnectionString = connectionString;
report.Prepare();
If you're using in memory DataSet then the quickest way is to create a simple app - a custom designer - which prepares the data set, sets it using report.RegisterData(dataSet, "ds"); and calls report.Design(). After you have saved the report template it will be compatible with your main code which will register the same data set.
Also, if you don't mind typing you can write the template manually. Something similar to the following
<Report>
<!-- other content-->
<Dictionary>
<TableDataSource Name="invoice" ReferenceName="ds.invoice" DataType="System.Int32" Enabled="true">
<Column Name="id" DataType="System.Int32"/>
<!-- other columns-->
</TableDataSource>
<TableDataSource Name="invoiceLine" ReferenceName="ds.invoiceLine" DataType="System.Int32" Enabled="true">
<Column Name="id" DataType="System.Int32"/>
<Column Name="invoiceId" DataType="System.Int32"/>
<Column Name="description" DataType="System.String"/>
<!-- other columns-->
</TableDataSource>
<Relation Name="invoice_invoiceLine" ReferenceName="ds.invoice_invoiceLine" ParentDataSource="invoice" ChildDataSource="invoiceLine" ParentColumns="id" ChildColumns="invoiceId" Enabled="true"/>
</Dictionary>
<!-- other content-->
</Report>
Did you know if I can edit this data set templates (add columns or remove columns) by the open source or demo designer? Or just manually by the code or xml as you comment?
@vitorquezada It is best to re-register a modified data set.
I just tried to register an object by doing as you suggested:
registered the Data by
report.registerData(dataset);
but the method Design() is not known?
Any suggestions on how to import this function?
Thanks
Hi,
FastReport OpenSource does not include Designer. It's available in FastReport .NET.
Best Regards, Oleg.
Hi! U can add a dictionary with a BusinessObjectDataSource in the xml of the .frx file and will appear in the designer
I'm sending you a test example of using the BusinessObject connection and using it in the report designer below
Application: https://drive.google.com/file/d/1qekxtTnNYi3elh_snKjY9rFOBXGYoSVJ/view?usp=sharing
Best regards, Bogdan
I'm sending you a test example of using the BusinessObject connection and using it in the report designer below
Application: https://drive.google.com/file/d/1qekxtTnNYi3elh_snKjY9rFOBXGYoSVJ/view?usp=sharing
Best regards, Bogdan
Thanks! I will check it out
Have a nice day!