Lazarus

Programming => Packages and Libraries => LazReport => Topic started by: mannewolff on October 11, 2012, 07:16:40 pm

Title: Alternative to Lazarus Report
Post by: mannewolff on October 11, 2012, 07:16:40 pm
The Lazarus Reports are quit easy, but buggy. Is there any alternative? I use csv tables and TsdfDataSet with LazReports and thats fine. But the functionality is very poor and buggy.

So if somebody has an alternative which can go with TsdfDataSet as well (not only sql access) please provide.
 
Title: Re: Alternative to Lazarus Report
Post by: jujibo on October 11, 2012, 08:33:09 pm
Buggy? You can fill a bug report so those bugs you are speaking about can be fixed.

http://bugs.freepascal.org/view_all_bug_page.php?project_id=1 (http://bugs.freepascal.org/view_all_bug_page.php?project_id=1)

Have you tried lr_codereport (addon for lazreport). You can do reports in code and you aren't limited to bands and such things.

For Lazarus you also have Fortes4Lazarus: http://fortes4lazarus.sourceforge.net/ (http://fortes4lazarus.sourceforge.net/)
Title: Re: Alternative to Lazarus Report
Post by: JuhaManninen on October 11, 2012, 09:11:21 pm
FastReport has also been ported to Lazarus. Zeljan demonstrated it in Lazaus day in Utrecht.
I don't know if it is officially published yet.
Title: Re: Alternative to Lazarus Report
Post by: jujibo on October 11, 2012, 09:24:34 pm
FastReport has also been ported to Lazarus. Zeljan demonstrated it in Lazaus day in Utrecht.
I don't know if it is officially published yet.

Lazreport is the port of FastReport to Lazarus ;)

FastReport v2.3

May be you are talking about another FastReport version?
Title: Re: Alternative to Lazarus Report
Post by: JanRoza on October 11, 2012, 10:28:07 pm
If you're that dissatisfied with LazReport, you can always try FortesReport which can do what LazReport can do and more. I love it.
Or wait for the Lazarus port of FastReport, but that will not be free I suspect.

 :)
Jan
Title: Re: Alternative to Lazarus Report
Post by: JuhaManninen on October 11, 2012, 10:50:45 pm
Lazreport is the port of FastReport to Lazarus ;)
FastReport v2.3
May be you are talking about another FastReport version?

No, both LazReport and FastReport are based on FreeReport.
FastReport is a commercial component, LazReport is free.
FastReport is already at version 4.

http://wiki.freepascal.org/LazReport_Documentation
http://www.fast-report.com/en/products/report-generator-for-delphi-fastreport-4.html

The Fast Report Inc. home page has no mention of the Lazarus port. Apparently it is not published yet.

@mannewolff, could you please make a bug report of your LazReport findings in any case, even if you choose another reporting tool.
Title: Re: Alternative to Lazarus Report
Post by: jujibo on October 12, 2012, 09:29:57 am

No, both LazReport and FastReport are based on FreeReport.
FastReport is a commercial component, LazReport is free.
FastReport is already at version 4.

http://wiki.freepascal.org/LazReport_Documentation
http://www.fast-report.com/en/products/report-generator-for-delphi-fastreport-4.html


Yes I know what wiki and the old Lazreport webpage say, but the source code say it's Fastreport, ie lr_class unit:


{*****************************************}
{                                         }
{             FastReport v2.3             }
{             Report classes              }
{                                         }
{  Copyright (c) 1998-99 by Tzyganenko A. }
{                                         }
{*****************************************}

Probably they only changed the headers and released it... I don't know.
Title: Re: Alternative to Lazarus Report
Post by: jujibo on October 12, 2012, 09:38:46 am
If you're that dissatisfied with LazReport, you can always try FortesReport which can do what LazReport can do and more. I love it.

It isn't the first time I heard this (about ... can do what Lazreport and more), but nobody say what is it.

Lazreport has useful addons that extends functionality, can create/modify reports definitions so you can change reports without recompiling your program...  of course none of those tools are perfect.
Title: Re: Alternative to Lazarus Report
Post by: JuhaManninen on October 12, 2012, 09:48:39 am
About FastReport v2.3, you are right jujibo. I don't know either what happened exactly. They must have changed FastReport license after that version.
Title: Re: Alternative to Lazarus Report
Post by: rc.1990 on January 13, 2014, 04:50:11 am
LazReport on Lazarus 1.2 will receive less complaints?
What I mean is if Lazarus 1.2 will correct many bugs related to LazReport.

Someone that have used both LazReport and FortesReport4Lazarus could share his/her experience and talk about the disadvantages and advantages on using FortesReport instead of LazReport?
Title: Re: Alternative to Lazarus Report
Post by: taazz on January 13, 2014, 06:41:58 am
free report is fast report. a Free reporting tool that required payment to give you access to hte frclasses unit. It is not a different component set than fast report it is fastReport in its very 1st steps.
Title: Re: Alternative to Lazarus Report
Post by: motaz on January 13, 2014, 09:20:14 am
Quote
Someone that have used both LazReport and FortesReport4Lazarus could share his/her experience and talk about the disadvantages and advantages on using FortesReport instead of LazReport?

I have started with LazReport as my first reporting tool with Lazarus before three years ago. The main disadvantage of it is that it has it's own designer and properties editor, and it is limited, also I have faced an error ( I can't recall it now ) when using two reports, then I changed to FortesReport. The main advantage of FortesReport is that you can put the report and it's components in a form and treat the component the same like normal Lazarus component, and use Lazarus property editor, events for report components.
Since three years I have been using FrotesReport with Linux and Windows applications, and it just fine, except for a bug related to Lazarus, which is unability to print Arabic letters in printer or PDF. Luiz Americo has reported this error for me in 2011, and still not solved yet http://bugs.freepascal.org/view.php?id=19435
I have tested today's Trunk version 1.3, revision 43719 and still the Arabic letters are missing in printing report
Title: Re: Alternative to Lazarus Report
Post by: Graeme on January 13, 2014, 10:10:22 am
You can also use tiRTFReport (included with the tiOPF framework on SourceForge). It allow you to use any RTF editor (eg: OpenOffice or MS Office) to design your template report. Then let the tiRTFReport engine populate it at runtime. I used this for years, and preferred to use OpenOffice as my template editor and "print preview" (because OpenOffice has a very nice "read-only" mode which looks just like a print preview report would). The tiRTFReport has many built-in functions, and allows you to define more functions using Object Pascal. All the usual reporting functionality is supported like master/details, groups etc. You can also generate reports from TDataset, Lists classes or your own objects from memory. It is very flexible.

Since about a year ago, I switched to a PDF reporting engine developed for fpGUI Toolkit. Good news is, that there is actually very little dependency on fpGUI. It should take a couple of minutes work to extract any fpGUI dependencies. I'm actually thinking of doing this so it could maybe be consider for inclusion in FPC's FCL. The PDF reporting engine is just that, an "engine that generates PDF's". It doesn't have any visual designers, but the amount of PDF features it has makes up for it. Coding reports with Object Pascal is pretty easy anyway.
Title: Re: Alternative to Lazarus Report
Post by: djzepi on January 13, 2014, 03:42:13 pm
In some cases
fpvectorial
http://wiki.lazarus.freepascal.org/fpvectorial_-_Text_Document_Support (http://wiki.lazarus.freepascal.org/fpvectorial_-_Text_Document_Support)

may be an alternative
(odt and docx files)
Title: Re: Alternative to Lazarus Report
Post by: allanregistos on August 11, 2014, 02:58:28 am
Since about a year ago, I switched to a PDF reporting engine developed for fpGUI Toolkit. Good news is, that there is actually very little dependency on fpGUI. It should take a couple of minutes work to extract any fpGUI dependencies. I'm actually thinking of doing this so it could maybe be consider for inclusion in FPC's FCL. The PDF reporting engine is just that, an "engine that generates PDF's". It doesn't have any visual designers, but the amount of PDF features it has makes up for it. Coding reports with Object Pascal is pretty easy anyway.

(It might be useful to post here on this old thread rather than creating a new thread.)

Hi, Graeme Geldenhuys,

Summary of my reporting experience with Lazarus.

I'm using Lazarus for the code and build my reports using Jasper Studio.  The good thing of Jasper is that it can be integrated with other reporting tools such as ReportServer or ART (A Reporting Tool- http://art.sourceforge.net/ ). ART is really an amazing reporting product in itself and it can also provide dashboards and many other types of reports you may need. It provide scheduling of reports delivered by email in most common formats.  So I am switching between the two ART and ReportServer depending on the needs.  The only thing that ART has problem with Jasper format is sub reports but really an amazing tool and with a built-in documentation.

I have not touch lazreport for now but I may have take a look.  The reason of my post is that I am curious how you manage your reporting via code. Can you at least provide a sample code for us to have a reference?

Thanks,
Allan
Title: Re: Alternative to Lazarus Report
Post by: Graeme on August 12, 2014, 11:14:10 pm
I have not touch lazreport for now but I may have take a look.  The reason of my post is that I am curious how you manage your reporting via code. Can you at least provide a sample code for us to have a reference?
No problem. I'll put a demo together over the weekend so you can see. I'll post here where to find it.
Title: Re: Alternative to Lazarus Report
Post by: Graeme on October 09, 2015, 01:25:51 pm
I have not touch lazreport for now but I may have take a look.  The reason of my post is that I am curious how you manage your reporting via code. Can you at least provide a sample code for us to have a reference?
Very sorry for the late reply... I completely forgot about this.

As I mentioned, I use fpGUI's PDF engine to do reporting, and I generate all my reports from code - thus I find them much more maintainable, searchable and more flexible in design. Here is a very simple listing report example. I have a lot more complex ones too, but I chose a simple one simply as an easy example.

My software is very Object Oriented - I don't use TDataSet and DB-aware components, everything is driven by Objects. I use tiOPF has my backend framework for loading and persisting objects to/from any database or data file. So my reporting is no different. I tend to create a "Report Data Object" which I can set the report parameters (eg: To/From date etc), then do a Read() which will load it up with all the data I need for my report.

Note:
tiOPF does supply a TDataset compatible class though, so you can hook up tiOPF based objects to TDataset driven code like DB-aware components, existing reporting tools etc. I don't do this though.

Here is the code for one such listing report:
Code: Pascal  [Select][+][-]
  1. procedure TEnrolmentListReportForm.Process_PDF_Report;
  2. var
  3.   rpt: TRptEnrolmentList;  // report object
  4.   lReport: T_Report;
  5.   itm: TRptEnrolmentItem;  // report repeatable data items
  6.   FtTitle: Integer;
  7.   FtText: Integer;
  8.   FtTextB: Integer;
  9.   lLineStyle: Integer;
  10.   LsTitle: Integer;
  11.   LsText: Integer;
  12.   Col: array[1..5] of Integer;  // this report is column based
  13.   lDataCount,lCol: Integer;
  14.   v: single;
  15.   s: string;
  16.   lCount: integer;
  17.   lAlignment: shortint;
  18.  
  19. const
  20.   cCentreAddressX = 120;
  21.  
  22.   procedure WritePageHeader;
  23.   begin
  24.     with lReport do
  25.     begin
  26.       // write title on each page
  27.       WriteHeader(cnLeft,lnEnd,'Enrolment List',ColDefaut,FtTitle,LsTitle);
  28.       // write page number and total of pages on each page
  29.       NumPageSectionFooter(cnRight,lnEnd,'Page','of',True,False, ColDefaut,FtText,LsText);
  30.     end;
  31.   end;
  32.  
  33.   procedure WriteAddress(const ACentre: TCentre);
  34.   begin
  35.     with lReport do
  36.     begin
  37.       // Centre address lines
  38.       WritePage(cnLeft,lnEnd,ACentre.Caption,Col[5],FtTextB,LsText);
  39.       // leave some whitespace
  40.       WritePage(cnLeft,lnEnd,' ',Col[1],FtText,LsText);
  41.       WritePage(cnLeft,lnEnd,' ',Col[1],FtText,LsText);
  42.     end;
  43.   end;
  44.  
  45.   procedure WriteColumnHeaders;
  46.   begin
  47.     with lReport do
  48.     begin
  49.       // Report filter details
  50.       WritePage(cnLeft,lnCurrent,Format('For Period: %s to %s', [FormatDateTime('yyyy-mm-dd', calStartDate.DateValue), FormatDateTime('yyyy-mm-dd', calEndDate.DateValue)]),ColDefaut,FtText,LsText);
  51.       WritePage(cnRight,lnEnd,'Date: ' + FormatDateTime('yyyy-mm-dd', Now),ColDefaut,FtText,LsText);
  52.       // Column headers
  53.       HorizLinePage(0,0,0,lLineStyle);
  54.       WritePage(cnLeft,lnCurrent,'Acc No.',Col[1],FtTextB,LsText);
  55.       WritePage(cnLeft,lnCurrent,'Billing Name',Col[2],FtTextB,LsText);
  56.       WritePage(cnLeft,lnCurrent,'Learner Name',Col[3],FtTextB,LsText);
  57.       WritePage(cnRight,lnEnd,'Effective Date',Col[4],FtTextB,LsText);
  58.       HorizLinePage(1,1,0,lLineStyle);
  59.     end;
  60.   end;
  61.  
  62. begin
  63.   tiProcessing(uiProcessing);
  64.   gM2Admin.TransTypeList.Read;
  65.   rpt := TRptEnrolmentList.Create;
  66.   try
  67.     // Set parameters and read report data
  68.     rpt.StartDate := calStartDate.DateValue;
  69.     rpt.EndDate := calEndDate.DateValue;
  70.     rpt.Centre := gM2Application.CurrentCentre;
  71.     rpt.Read;
  72.     if rpt.Count = 0 then
  73.     begin
  74.       tiEndProcessing;
  75.       tiAppMessage(uiErrNoDataExistsForReport);
  76.       Exit; //==>
  77.     end;
  78.  
  79.     lReport:= T_Report.Create;
  80.     try
  81.       with lReport do
  82.       begin
  83.         DefaultFile:= 'Enrolment_List.pdf';
  84.         // define orientation, page format, measurement unit, language, preview (true) or print (false)
  85.         BeginWrite(oPortrait,A4,msMM,'E',True);
  86.         // create the fonts to be used (use one of the 14 Adobe PDF standard fonts)
  87.         FtTitle := Font('helvetica-15:bold',clBlack);
  88.         FtText  := Font('helvetica-7',clBlack);
  89.         FtTextB := Font('helvetica-7:bold',clBlack);
  90.         // create columns to be used
  91.         Col[1]:= Column(10,23,0);  // Acc No
  92.         Col[2]:= Column(35,38,0);  // Billing Name
  93.         Col[3]:= Column(75,76,0);  // Learner
  94.         Col[4]:= Column(155,30,0);  // Effective Date
  95.  
  96.         Col[5]:= Column(cCentreAddressX,70,0);  // Centre Address
  97.  
  98.         // create a new section and define the margins with an additional one due to frames drawing
  99.         Section(10,10,10,10);
  100.  
  101.         // create the style of lines to be used
  102.         lLineStyle:= LineStyle(0.5,clBlack,lsSolid);
  103.         // create line spacings to be used
  104.         LsTitle := LineSpace(3,0,3);
  105.         LsText := LineSpace(1,0,0);
  106.  
  107.         WritePageHeader;
  108.         WriteAddress(rpt.Centre);
  109.         WriteColumnHeaders;
  110.  
  111.         lCount := 0;
  112.  
  113.         // now the actual report data (repeated rows)
  114.         for lDataCount:= 0 to rpt.Count-1 do
  115.         begin
  116.           itm := TRptEnrolmentItem(rpt.Items[lDataCount]);
  117.           lCount := lCount + 1;
  118.           for lCol := 1 to 4 do
  119.           begin
  120.             if lCol = 4 then
  121.               v := lnEnd
  122.             else
  123.               v := lnCurrent;
  124.             s := '';
  125.             lAlignment := cnLeft;
  126.             case lCol of
  127.               1:  s := itm.AccountNo;
  128.               2:  s := itm.BillingName;
  129.               3:  s := itm.FirstName + ' ' + itm.LastName;
  130.               4:
  131.               begin
  132.                 s := FormatDateTime('yyyy-mm-dd', itm.EffectiveDate);
  133.                 lAlignment := cnRight;
  134.               end;
  135.             end;
  136.             WritePage(lAlignment,v,s,Col[lCol],FtText,LsText);
  137.           end;
  138.         end;
  139.         // Leave some whitespace, then write the totals
  140.         WritePage(cnLeft,lnEnd,'',Col[1],FtText,LsText);
  141.         if lCount = 1 then
  142.           WritePage(cnRight,lnEnd,IntToStr(lCount) + ' item found',ColDefaut,FtTextB,LsText)
  143.         else
  144.           WritePage(cnRight,lnEnd,IntToStr(lCount) + ' items found',ColDefaut,FtTextB,LsText);
  145.  
  146.         // preparation is finished, so create PDF objects
  147.         tiEndProcessing;
  148.         EndWrite;
  149.       end;
  150.     finally
  151.       lReport.Free;
  152.     end;
  153.  
  154.   finally
  155.     rpt.Free;
  156.   end;
  157. end;
  158.  

And here is a screenshot of the generated PDF. As I said, this is a very simple report - but should get the point across.
TinyPortal © 2005-2018