Recent

Author Topic: A wishlist for fpreport  (Read 8039 times)

MacWomble

  • Jr. Member
  • **
  • Posts: 79
A wishlist for fpreport
« on: December 31, 2019, 11:33:46 am »
I know fpreport is part of FPC, but the main wishes are for the designer:

fpreport is a fairly good approach to creating reports, but it is currently not possible to create more complex reports. (I'll explain that later).
(At least not with the designer)

After spending some time trying, I have now put together a 'wish list'. Unfortunately, I don't really get along with the source code because my knowledge is not sufficient.

Since I create reports with the designer and do not want large unit dependencies, the main points relate to the designer.

1.
The detail header and detail footer must be able to be output on every page of the report. Otherwise it is currently not possible to create meaningful invoices.
Background: In the case of an invoice over several pages, the running total must be output under the details, on the following page the transfer (according to the detailed headings) above the first position.

2.
There should be a way to check in the report whether the currently output page is the last page with detailed data.
A check like PageNo = PageCount is not sufficient here!
Background: This is necessary to control the totals.

3.
In the data editor you can define the field names for csv. It should also be possible to define the type and size here. (As with json).
In addition, a selection may be useful (checkbox) to 'Supress first line'.
Background: Longer text fields (at least from csv) are cut off after 256 characters.
This results from defaultsize when reading csv.

4.
Reports with json data cannot be generated with the designer. An access violation occurs.

4a.
In the attached sample report I use csv data out of 4 files. However, this should also be possible with a single structured json file.

5.
The graphic is saved several times in the report, although it is always the same. Optionally, you should only be able to save the path to the graphic (select link or include).
Background: It happens that a report file is inflated unnecessarily.

6.
Transparency should be supported with png, SVG would generally also be desirable.

7.
Sums must be able to be formed, i.e. values ​​should be assignable to the variables.
This may require simple scripting (well solved in Lazreport).

7a.
How can variables be used? I don't get a solution.

8.
Elements and bands should be handled with copy / paste (cross-report).

9.
The report designer is very susceptible to incorrect entries and you then accidentally close it. All entries are then lost.

10.
Texts from MySQL are not read correctly if they come from text, tiny text, medium text or long text fields. Here only VARCHAR () seems to be possible for text.
Not that bad if you take this into account, but it is still a mistake.

I am still attaching my current test report.
Attention: The report designer must be copied into the folder, otherwise the paths are incorrect (I have deleted the path information in the report).

My opinion at the moment on fpReport:

There are still some important things that should be done.
Then, however, a very good, really useful reporter for Lazarus would finally be a reality.
It would be unfortunate if fpReport were given the same fate as the other players.

Unfortunately, there is no other way to continue using lazreport and to deal with its weaknesses ...

FpReport can already be used very well for simple reports.

I could also imagine a function for label printing, it would even be relatively simple:
A dialog asks which label should be used for printing. 'Blank details are inserted accordingly' ...
I actually do this currently with empty data records, since the query takes place in the program before data preparation.

In general, I cannot generate the reports in my units, as this means that the flexibility that is needed will be lost.

I hope someone is willing to help with making fpreport the best reporter for FPC
and wish you all a good and successful 2020!
Mint 19.3 Cinnamon, FPC/ Lazarus Trunk 64Bit

af0815

  • Hero Member
  • *****
  • Posts: 1291
Re: A wishlist for fpreport
« Reply #1 on: December 31, 2019, 04:32:43 pm »
Attention: The report designer must be copied into the folder, otherwise the paths are incorrect (I have deleted the path information in the report).
If the report data is in the same place like the report, it should be found without copy the designer in that place. The reason is, the default dir where the data is searched is not set. Relative path of the data(sets) in relation to the report are IMHO not working too.
regards
Andreas

MacWomble

  • Jr. Member
  • **
  • Posts: 79
Re: A wishlist for fpreport
« Reply #2 on: January 03, 2020, 11:13:22 am »
Found another issue:

When report source is db then preview only can be called once, because the dataset is then open.
Mint 19.3 Cinnamon, FPC/ Lazarus Trunk 64Bit

Pascal

  • Hero Member
  • *****
  • Posts: 932
Re: A wishlist for fpreport
« Reply #3 on: January 06, 2020, 10:43:10 pm »
I'll try to find some time to address these issues/wishes.
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

af0815

  • Hero Member
  • *****
  • Posts: 1291
Re: A wishlist for fpreport
« Reply #4 on: January 06, 2020, 10:48:31 pm »
I think a good idea is, to get the tests running without an error. See https://bugs.freepascal.org/view.php?id=36519 too.

So i can add to the wishlist, make it running on a german system, without a dot/comma problem.
regards
Andreas

Pascal

  • Hero Member
  • *****
  • Posts: 932
Re: A wishlist for fpreport
« Reply #5 on: January 15, 2020, 11:49:11 am »
1.
The detail header and detail footer must be able to be output on every page of the report. Otherwise it is currently not possible to create meaningful invoices.
Background: In the case of an invoice over several pages, the running total must be output under the details, on the following page the transfer (according to the detailed headings) above the first position.

Use GroupHeader/GroupFooter instead. See nestedgroups in demo app ("fcldemo -d nestedgroups").
GroupFooter or ChildBand with VisibleExpr := "InIntermediateGroupFooter" or "not InIntermediateGroupFooter".
GroupHeader or ChildBand with VisibleExpr := "InRepeatedGroupHeader" or "not InRepeatedGroupHeader".

For running totals i am working on a patch. At the moment you'l see the total of the group instead!

2.
There should be a way to check in the report whether the currently output page is the last page with detailed data.
A check like PageNo = PageCount is not sufficient here!
Background: This is necessary to control the totals.

Not needed if you use GroupHeader/GroupFooter and aggregate variables. See nestedgroups demo.

7.
Sums must be able to be formed, i.e. values ​​should be assignable to the variables.
This may require simple scripting (well solved in Lazreport).

7a.
How can variables be used? I don't get a solution.

See variable definition in nestedgroups demo.

Code: Pascal  [Select][+][-]
  1.   rpt.Variables.AddExprVariable('population_in_M', 'StrToFloat(data.population) / 1000000', rtFloat, rtNone, '');
  2.   rpt.Variables.AddExprVariable('grp1region_sum_population_in_M', 'sum(StrToFloat(data.population) / 1000000)', rtFloat, GroupHeader1Region);
  3.   rpt.Variables.AddExprVariable('grp1region_sum_population', 'sum(StrToFloat(data.population))', rtFloat, GroupHeader1Region);
  4.   rpt.Variables.AddExprVariable('grp2subregion_sum_population_in_M', 'sum(StrToFloat(data.population) / 1000000)', rtFloat, GroupHeader2Subregion);
  5.   rpt.Variables.AddExprVariable('grp2subregion_sum_population', 'sum(StrToFloat(data.population))', rtFloat, GroupHeader2Subregion);
  6.   rpt.Variables.AddExprVariable('grp3initial_sum_population_in_M', 'sum(StrToFloat(data.population) / 1000000)', rtFloat, GroupHeader3Initial);
  7.   rpt.Variables.AddExprVariable('grp3initial_sum_population', 'sum(StrToFloat(data.population))', rtFloat, GroupHeader3Initial);
  8.   rpt.Variables.AddExprVariable('total_sum_population_in_M', 'sum(StrToFloat(data.population) / 1000000)', rtFloat);
  9.   rpt.Variables.AddExprVariable('total_sum_population', 'sum(StrToFloat(data.population))', rtFloat);
  10.  
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

MacWomble

  • Jr. Member
  • **
  • Posts: 79
Re: A wishlist for fpreport
« Reply #6 on: January 15, 2020, 04:29:49 pm »
Thank You for your hints. I'll try this on my report.
But I thnink it is not possible to format values Like '1.234,00' instead of '1,2345.00'.
The first one is used e.g. in Germany.

To use groups here is not absolute logical, but if it works it would be great.

A 'Lastpage' is also useful for other report behaviors!
« Last Edit: January 15, 2020, 04:37:50 pm by MacWomble »
Mint 19.3 Cinnamon, FPC/ Lazarus Trunk 64Bit

Pascal

  • Hero Member
  • *****
  • Posts: 932
Re: A wishlist for fpreport
« Reply #7 on: January 15, 2020, 05:53:44 pm »
Thank You for your hints. I'll try this on my report.
But I thnink it is not possible to format values Like '1.234,00' instead of '1,2345.00'.The first one is used e.g. in Germany.

Use Memo with:
Code: Pascal  [Select][+][-]
  1. Text := '[formatfloat(''#,##0.000'', population_in_M)]'
Number is formated with curent locale.

To use groups here is not absolute logical, but if it works it would be great.

Think of a report which renders a list of multiple invoices and the main group is the invoice number. Second group could be the delivery note.
I'll prepare a report with invoice, invoice note and advise note.

A 'Lastpage' is also useful for other report behaviors!

I know. I'll do this later.
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

MacWomble

  • Jr. Member
  • **
  • Posts: 79
Re: A wishlist for fpreport
« Reply #8 on: January 15, 2020, 06:33:39 pm »

Use Memo with:
Code: Pascal  [Select][+][-]
  1. Text := '[formatfloat(''#,##0.000'', population_in_M)]'
Number is formated with curent locale.


An error occurs: Unknown character '#' at Pos 15
Mint 19.3 Cinnamon, FPC/ Lazarus Trunk 64Bit

MacWomble

  • Jr. Member
  • **
  • Posts: 79
Re: A wishlist for fpreport
« Reply #9 on: January 15, 2020, 07:06:30 pm »
Ok, got it partilly working (using single quote):

in my csv 'Preis' is 10.10 (10 Euro + 10 Ct)

Code: Pascal  [Select][+][-]
  1. [formatfloat('#.##0,00 €',strtofloat(d.Preis))]

I get 10.10000 €

That is wrong ! It must be: 10,10 € ! (German convention)

Code: Pascal  [Select][+][-]
  1. [formatfloat('#,##0.00 €',strtofloat(d.Preis))]

I get 10.10 €

Seems to be right, but useless in Germany

« Last Edit: January 15, 2020, 07:09:08 pm by MacWomble »
Mint 19.3 Cinnamon, FPC/ Lazarus Trunk 64Bit

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11447
  • FPC developer.
Re: A wishlist for fpreport
« Reply #10 on: January 15, 2020, 07:10:12 pm »
I get 10.10 €

The format string is always in US locale. But the result is in localized locale. If it doesn't match, it means somehow your locale was not detected properly. If on *nix did you add clocale to your main program uses line (near the top) ?

MacWomble

  • Jr. Member
  • **
  • Posts: 79
Re: A wishlist for fpreport
« Reply #11 on: January 15, 2020, 08:12:51 pm »
As the main program is the fpreportdesign I changed nothing in code!

But I tested in my app now, where I have:
Code: Pascal  [Select][+][-]
  1.     DefaultFormatSettings.ThousandSeparator := '.';
  2.     DefaultFormatSettings.DecimalSeparator := ',';  

I got an error 10.10 is not a valid float.

I changed 10.10 in my csv to 10,10 and now I get '10,10000 €'
with '[formatfloat('#,##0.00 €',strtofloat(d.Preis))]'
« Last Edit: January 15, 2020, 08:49:32 pm by MacWomble »
Mint 19.3 Cinnamon, FPC/ Lazarus Trunk 64Bit

Pascal

  • Hero Member
  • *****
  • Posts: 932
Re: A wishlist for fpreport
« Reply #12 on: January 15, 2020, 09:42:22 pm »
I changed 10.10 in my csv to 10,10 and now I get '10,10000 €'
with '[formatfloat('#,##0.00 €',strtofloat(d.Preis))]'

Strange! I get '10,10 €'
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

MacWomble

  • Jr. Member
  • **
  • Posts: 79
Re: A wishlist for fpreport
« Reply #13 on: January 15, 2020, 09:47:36 pm »
 :o
Mint 19.3 Cinnamon, FPC/ Lazarus Trunk 64Bit

af0815

  • Hero Member
  • *****
  • Posts: 1291
Re: A wishlist for fpreport
« Reply #14 on: January 15, 2020, 10:28:12 pm »
i think it is a good idea to add tests for different locale settings in fpreport. so can be tested for other formatsettings.

one more question is, is everybody using the last trunk. because some changes affect this behavior.
« Last Edit: January 15, 2020, 10:30:25 pm by af0815 »
regards
Andreas

 

TinyPortal © 2005-2018