In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.

Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.

Batch printing - prepared report

FastReport for Xailer & [x]Harbour (English/Spanish)
dmajkic
Posts: 21
Joined: Wed Sep 24, 2014 12:48 pm

Batch printing - prepared report

Postby dmajkic » Tue Oct 28, 2014 4:59 pm

In FR documentation there is a neat feature which enables FR to print multiple documents in one go. Like this:
 
frxReport1.LoadFromFile('Invoice.fr3');
frxReport1.PrepareReport;
frxReport1.LoadFromFile('StorageOrder.fr3');
frxReport1.PrepareReport(False);
frxReport1.ShowPreparedReport;

The idea is to print Invoice, Storage order (...) in one go.
There is FRX support for PrepareReport(), but I always get first report.
Is this supported? Example?
--
Dusan Majkic
Wings Software
User avatar
ignacio
Site Admin
Posts: 8246
Joined: Mon Apr 06, 2015 8:00 pm
Location: Madrid, Spain
Contact:

Batch printing - prepared report

Postby ignacio » Wed Oct 29, 2014 9:40 am

dmajkic escribió el mar, 28 octubre 2014 16:59
In FR documentation there is a neat feature which enables FR to print multiple documents in one go. Like this:
 
frxReport1.LoadFromFile('Invoice.fr3');
frxReport1.PrepareReport;
frxReport1.LoadFromFile('StorageOrder.fr3');
frxReport1.PrepareReport(False);
frxReport1.ShowPreparedReport;

The idea is to print Invoice, Storage order (...) in one go.
There is FRX support for PrepareReport(), but I always get first report.
Is this supported? Example?
--
Dusan Majkic
Wings Software

Yes is supported. The example would almost like your, just change the dot with double dot.
Regards,
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info
dmajkic
Posts: 21
Joined: Wed Sep 24, 2014 12:48 pm

Re: Batch printing - prepared report

Postby dmajkic » Fri Dec 02, 2016 4:38 pm

Tried this again, but it is not working. I do this:

Code: Select all

// First Invoice
frxReport1:LoadFromFile('Invoice.fr3')
frxReport1:AddDbf( "INVOICE", {"INVOICE->*"} )
frxReport1:PrepareReport()

// Second Invoice (code is not there, invoice data is different )
frxReport1:LoadFromFile('Invoice.fr3')
frxReport1:AddDbf( "INVOICE", {"INVOICE->*"} )
frxReport1:PrepareReport(.T.)

frxReport1:ShowReport(.T.)


But the data on both invoices are from first report. Like the new AddDbf() is not replacing data.
Setting variables to new values do work.
User avatar
ignacio
Site Admin
Posts: 8246
Joined: Mon Apr 06, 2015 8:00 pm
Location: Madrid, Spain
Contact:

Re: Batch printing - prepared report

Postby ignacio » Wed Dec 07, 2016 12:50 pm

Please try calling TFastReport:ForceReload() before calling AddDbf() the second time. Something like this:

Code: Select all

WITH OBJECT ::oFrx
  SET FILTER TO ...
  GO TOP
  :AddDbf("biolife", "biolife->*" )
  :PrepareReport(.F.)
  SET FILTER TO ...
  GO TOP
  :ForceReload()
  :AddDbf("biolife", "biolife->*" )
  :PrepareReport(.T.)
  :ShowPreparedReport()
END WITH


Regards,
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info
dmajkic
Posts: 21
Joined: Wed Sep 24, 2014 12:48 pm

Re: Batch printing - prepared report

Postby dmajkic » Thu Dec 08, 2016 12:33 am

Thank you Ignacio for your fast response!

With ForceReload I have distinct data, but variables are gone.

Please find minimal example attached. You can build it with "hbmk2 b.hbp". Set your licence and copy latest frx.dll in folder.
frx_test_multireport.zip
(51.36 KiB) Downloaded 19 times
nbatocanin
Posts: 23
Joined: Sat Aug 10, 2013 2:39 am

Re: Batch printing - prepared report

Postby nbatocanin » Thu Dec 08, 2016 4:11 am

This program works:

Code: Select all

oFr:Create()

Art->a_name := "Field 1111"
oFr:LoadFromFile ("report.fr3")
oFr:AddDbf ("ART", {"ART->*"})
oFr:PrepareReport(.F.)

Art->a_name := "Field 2222"
oFr:LoadFromFile ("report.fr3")
oFr:AddDbf ("ART", {"ART->*"})
oFr:PrepareReport(.T.)

oFr:ShowReport (.T.)


Report writes:

P1: Field 1111
P2: Field 2222

But this does not work:

Code: Select all

oFr:Create()

Art->a_name := "This is 1111"
oFr:LoadFromFile ("report.fr3")
oFr:AddDbf ("ART", {"ART->*"})
oFr:AddVariable ("VAR", "X", 1)        //  1
oFr:PrepareReport(.F.)

Art->a_name := "This is 2222"
oFr:LoadFromFile ("report.fr3")
oFr:AddDbf ("ART", {"ART->*"})
oFr:AddVariable ("VAR", "X", 2)      // 2
oFr:PrepareReport(.T.)

oFr:ShowReport (.T.)


Pages:

P1: Field 1111 x = 1
P2: Field 1111 x = 2

When I im change order to:

oFr:LoadFromFile ("report.fr3")
oFr:AddVariable ("VAR", "X", 1) // 1
oFr:AddDbf ("ART", {"ART->*"})

Then report does not see variable X.
User avatar
ignacio
Site Admin
Posts: 8246
Joined: Mon Apr 06, 2015 8:00 pm
Location: Madrid, Spain
Contact:

Re: Batch printing - prepared report

Postby ignacio » Fri Dec 09, 2016 11:33 am

Hello,

Here is working fine! See report attached.

BTW, I have just upload the latest version of FRX for console mode on our download area:

http://www.xailer.com/download?en&file=103

Regards,
Attachments
Report.rar
(1.46 KiB) Downloaded 23 times
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info
nbatocanin
Posts: 23
Joined: Sat Aug 10, 2013 2:39 am

Re: Batch printing - prepared report

Postby nbatocanin » Fri Dec 09, 2016 3:47 pm

After new version instalation:

Error BASE/1082 Argument error: -
Called from TFRARRAYDATASET:LOAD(549)
Called from FRAPP:LOADDATA(400)
Called from FRAPP:LOADREPORT(486)
Called from FRAPP:LOADFROMFILE(661)
Called from FR_REPORT(582)
User avatar
ignacio
Site Admin
Posts: 8246
Joined: Mon Apr 06, 2015 8:00 pm
Location: Madrid, Spain
Contact:

Re: Batch printing - prepared report

Postby ignacio » Fri Dec 09, 2016 4:27 pm

Hello,

Array can not be empty. BTW, run time error controlled for next release.

Regards,
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info
nbatocanin
Posts: 23
Joined: Sat Aug 10, 2013 2:39 am

Re: Batch printing - prepared report

Postby nbatocanin » Fri Dec 09, 2016 6:21 pm

ignacio wrote:Hello,

Array can not be empty. BTW, run time error controlled for next release.

Regards,


I use the older version (1.5.1411.27) and it accepts empty arrays (= DBF tables without records) without any problems. It is impossible for me to change the all program/reports and looking for all the places where they appear empty arrays. Is there a some solution at the FastReport level? I think that some run time error control handler is not a good solution.
nbatocanin
Posts: 23
Joined: Sat Aug 10, 2013 2:39 am

Re: Batch printing - prepared report

Postby nbatocanin » Mon Dec 19, 2016 1:23 am

Sorry to bother you, but this is very important to me.

Is there any chance of returning to the old way of working with empty arrays? Older versions accepts empty arrays and not report an error when this happens.

Regards, NB
User avatar
ignacio
Site Admin
Posts: 8246
Joined: Mon Apr 06, 2015 8:00 pm
Location: Madrid, Spain
Contact:

Re: Batch printing - prepared report

Postby ignacio » Mon Dec 19, 2016 10:52 am

Hello,

Sorry, your message has been unintentionally forgotten.

I hope you can include a simple line in the source code of FrDataset.prg. In case not I will upload a new version. Here is the code:

Code: Select all

METHOD Load( lDesign )  CLASS XFrArrayDataset
   .....
   .....
   .....
   oRep   := ::oReport
   nPos   := 1   <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< NEW LINE
   aData  := ::aData
   .....
   .....
   .....
RETURN .T.


Regards
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info
nbatocanin
Posts: 23
Joined: Sat Aug 10, 2013 2:39 am

Re: Batch printing - prepared report

Postby nbatocanin » Tue Dec 20, 2016 2:35 am

I found FrDataset.prg, but do not know how to include this PRG into my program?

Regards, NB


ignacio wrote:Hello,

Sorry, your message has been unintentionally forgotten.

I hope you can include a simple line in the source code of FrDataset.prg. In case not I will upload a new version. Here is the code:

Code: Select all

METHOD Load( lDesign )  CLASS XFrArrayDataset
   .....
   .....
   .....
   oRep   := ::oReport
   nPos   := 1   <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< NEW LINE
   aData  := ::aData
   .....
   .....
   .....
RETURN .T.


Regards
User avatar
ignacio
Site Admin
Posts: 8246
Joined: Mon Apr 06, 2015 8:00 pm
Location: Madrid, Spain
Contact:

Re: Batch printing - prepared report

Postby ignacio » Tue Dec 20, 2016 10:03 am

New install file: https://dl.dropboxusercontent.com/u/31888702/Xailer/frx15.exe

Please confirm it works as expected. TIA.
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info
nbatocanin
Posts: 23
Joined: Sat Aug 10, 2013 2:39 am

Re: Batch printing - prepared report

Postby nbatocanin » Tue Dec 20, 2016 3:24 pm

Unfortunately, there is still a problem. Pleas look this test program:

Code: Select all

PROC Main
      USE Art NEW EXCLUSIVE

      oFr := frReportManager():New()
      oFr:cFRLicense := ...
      oFr:cXALicense := ...

   Art->a_name := "This is 1111"
      oFR:Create()
   oFr:LoadFromFile ("report.fr3")
   oFr:AddDbf ("ART", {"ART->*"})
   oFr:AddVariable ("VAR", "X", 1)

   oFr:DesignReport()
   oFr:ShowReport (.T.)
RETURN


This program work perfect with old version. In new version, designer does not see variable X!

One more thing: please add "instalation dir" in instalation procedure. Now you can not even see where the program is installed. Also, without question FRX is install on the old path and overwrite the old version with no questions asked.

Regards, NB

ignacio wrote:New install file: https://dl.dropboxusercontent.com/u/31888702/Xailer/frx15.exe

Please confirm it works as expected. TIA.
User avatar
ignacio
Site Admin
Posts: 8246
Joined: Mon Apr 06, 2015 8:00 pm
Location: Madrid, Spain
Contact:

Re: Batch printing - prepared report

Postby ignacio » Tue Dec 20, 2016 4:34 pm

Hello,

Review FUNCTION Sergey() on module FRConsole.prg (line 364). Here is working fine.

Regards,
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info
nbatocanin
Posts: 23
Joined: Sat Aug 10, 2013 2:39 am

Re: Batch printing - prepared report

Postby nbatocanin » Wed Dec 21, 2016 4:35 pm

ignacio wrote:Hello,

Review FUNCTION Sergey() on module FRConsole.prg (line 364). Here is working fine.

Regards,


Sorry, I do not understand? Line 364 is:

:AddVariable( "Categoria", "Nombre", 123 )

I use:

oFr:AddVariable ("VAR", "X", 1)

This is the same? I rewrote the program so it does not use the Sergey-specific commands (I think). Can you tell me exactly which command is the problem?
User avatar
ignacio
Site Admin
Posts: 8246
Joined: Mon Apr 06, 2015 8:00 pm
Location: Madrid, Spain
Contact:

Re: Batch printing - prepared report

Postby ignacio » Wed Dec 21, 2016 8:19 pm

Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info
nbatocanin
Posts: 23
Joined: Sat Aug 10, 2013 2:39 am

Re: Batch printing - prepared report

Postby nbatocanin » Thu Dec 22, 2016 3:28 am

Sorry, I still do not understand?

User avatar
ignacio
Site Admin
Posts: 8246
Joined: Mon Apr 06, 2015 8:00 pm
Location: Madrid, Spain
Contact:

Re: Batch printing - prepared report

Postby ignacio » Thu Dec 22, 2016 1:08 pm

From the link given:

Another new operator - WITH OBJECT:

Code: Select all

      WITH OBJECT expression
         ...
      ENDWITH

It allows to simplify the code for the reasonable use :

Code: Select all

      // you can write
      WITH OBJECT myobj:a[1]:myitem
         :message( 1 )
         :value := 9
      ENDWITH

      // instead of
      myobj:a[1]:myitem:message( 1 )
      myobj:a[1]:myitem:value := 9
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info
nbatocanin
Posts: 23
Joined: Sat Aug 10, 2013 2:39 am

Re: Batch printing - prepared report

Postby nbatocanin » Thu Dec 22, 2016 8:15 pm

Ok, but I do not see the connection with this problem? This program with the new version does not work properly.

Code: Select all

PROC Main
   USE Art NEW EXCLUSIVE

   oFr := frReportManager():New()
   oFr:cFRLicense := ...
   oFr:cXALicense := ...
   
   Art->a_name := "This is 1111"
   oFR:Create()
   oFr:LoadFromFile ("report.fr3")
   oFr:AddDbf ("ART", {"ART->*"})
   oFr:AddVariable ("VAR", "X", 1)

   oFr:DesignReport()
   oFr:ShowReport (.T.)
RETURN


Why? This is a very simple program and I do not see why it does not work properly?

Regards, NB

ignacio wrote:From the link given:

Another new operator - WITH OBJECT:

Code: Select all

      WITH OBJECT expression
         ...
      ENDWITH

It allows to simplify the code for the reasonable use :

Code: Select all

      // you can write
      WITH OBJECT myobj:a[1]:myitem
         :message( 1 )
         :value := 9
      ENDWITH

      // instead of
      myobj:a[1]:myitem:message( 1 )
      myobj:a[1]:myitem:value := 9
anser
Posts: 2
Joined: Sat Mar 11, 2017 5:59 am

Re: Batch printing - prepared report

Postby anser » Wed May 10, 2017 11:03 am

Is there any solution for this problem ?

I too have the same issue. The variables added from PRG does not appear in the FastReport

oFr:AddVariable ("VAR", "X", 1)

Return to “FastReport”

cron