Getting started with Fast reports
I have just got a copy of XE3 and decided to have a go at recoding all my reports to use FastReports instead of Rave. Most are code based and not suitable for the designer, a few are designer form based.
1. Can anybody recommend a good place to look for example projects of code based reports so I can get a feel for how they work and general design principles before I start on my rather complex reports.
2. As a start I have successfully created a designer form that I could use for one report but got stuck when looking at how to transfer data to it. Every example I can find assumes data is in a database but mine is in a Record structure - how do I transfer an element in a record to a text item on a designed page?
3. I found a post saying I could create a fastreport file from an existing rave designer report by using frxReport1.LoadFromFile() to load the rave file and then saving it but the loadfromfile command fails saying the file structure is not valid. Are there reasons why that might happen given that the file works perfectly well (it was initially created by rave 5.3 in Delphi 7 but has been updated by rave 7.7 in Delphi 2010)?
1. Can anybody recommend a good place to look for example projects of code based reports so I can get a feel for how they work and general design principles before I start on my rather complex reports.
2. As a start I have successfully created a designer form that I could use for one report but got stuck when looking at how to transfer data to it. Every example I can find assumes data is in a database but mine is in a Record structure - how do I transfer an element in a record to a text item on a designed page?
3. I found a post saying I could create a fastreport file from an existing rave designer report by using frxReport1.LoadFromFile() to load the rave file and then saving it but the loadfromfile command fails saying the file structure is not valid. Are there reasons why that might happen given that the file works perfectly well (it was initially created by rave 5.3 in Delphi 7 but has been updated by rave 7.7 in Delphi 2010)?
Comments
Is my question really so difficult that nobody can answer it?
Lets try a different approach. I start a new vcl forms application. I add an OK button + TfrxReport + TfrxUserDataSet (with one field) to the form and double click the TfrxReport to design a print with a 3 column page and a title band and a second band which is TfrxMasterData. I set the DataSet to the userdataset on the main form, add two memos to it. One has hard coded text, the other is set to the field in the userdataset.
I save the designed print form and in the onclick event of the button I put:
//code
Dataset1.Fields[0] := 'Some text';
frxReport1.ShowReport;
//end code
I get the title and the hard coded text but do not get 'Some text'. What do I need to do to display the text?
I also get the hard coded text repeated 3 times across the page and down the page for what seems to be an infinite print - how do I control how many times it prints (actually what I need is to print the masterdata band one at a time until my data runs out. In the real case the data is in an array of TRecord that contains many fields with text, symbols and numbers.
I have one annoying issue however - I want my output in 3 columns counting 1,2,3 across the page then 4,5,6 in row 2 etc. I can do this by setting page columns to 1 and databand columns to 3 but if the total results are not divisible by 3 the box surrounding the last result expands across the page. How can I stop that? If I set page columns to 3 it solves that issue but counts down the page rather than across it.