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)
Responder
dmajkic
Mensajes: 23
Registrado: Mié Sep 24, 2014 12:48 pm

Batch printing - prepared report

Mensaje por dmajkic »

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
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9246
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

Batch printing - prepared report

Mensaje por ignacio »

dmajkic escribió el mar, 28 octubre 2014 16:59In 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]
https://www.xailer.com
dmajkic
Mensajes: 23
Registrado: Mié Sep 24, 2014 12:48 pm

Re: Batch printing - prepared report

Mensaje por dmajkic »

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

Código: Seleccionar todo

// 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.
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9246
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

Re: Batch printing - prepared report

Mensaje por ignacio »

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

Código: Seleccionar todo

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]
https://www.xailer.com
dmajkic
Mensajes: 23
Registrado: Mié Sep 24, 2014 12:48 pm

Re: Batch printing - prepared report

Mensaje por dmajkic »

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) Descargado 4237 veces
nbatocanin
Mensajes: 42
Registrado: Sab Ago 10, 2013 2:39 am

Re: Batch printing - prepared report

Mensaje por nbatocanin »

This program works:

Código: Seleccionar todo

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:

Código: Seleccionar todo

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.
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9246
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

Re: Batch printing - prepared report

Mensaje por ignacio »

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,
Adjuntos
Report.rar
(1.46 KiB) Descargado 4163 veces
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
https://www.xailer.com
nbatocanin
Mensajes: 42
Registrado: Sab Ago 10, 2013 2:39 am

Re: Batch printing - prepared report

Mensaje por nbatocanin »

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)
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9246
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

Re: Batch printing - prepared report

Mensaje por ignacio »

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]
https://www.xailer.com
nbatocanin
Mensajes: 42
Registrado: Sab Ago 10, 2013 2:39 am

Re: Batch printing - prepared report

Mensaje por nbatocanin »

ignacio escribió: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
Mensajes: 42
Registrado: Sab Ago 10, 2013 2:39 am

Re: Batch printing - prepared report

Mensaje por nbatocanin »

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
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9246
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

Re: Batch printing - prepared report

Mensaje por ignacio »

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:

Código: Seleccionar todo

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]
https://www.xailer.com
nbatocanin
Mensajes: 42
Registrado: Sab Ago 10, 2013 2:39 am

Re: Batch printing - prepared report

Mensaje por nbatocanin »

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

Regards, NB

ignacio escribió: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:

Código: Seleccionar todo

METHOD Load( lDesign )  CLASS XFrArrayDataset
   .....
   .....
   .....
   oRep   := ::oReport
   nPos   := 1   <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< NEW LINE
   aData  := ::aData
   .....
   .....
   .....
RETURN .T. 
Regards
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9246
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

Re: Batch printing - prepared report

Mensaje por ignacio »

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

Please confirm it works as expected. TIA.
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
https://www.xailer.com
nbatocanin
Mensajes: 42
Registrado: Sab Ago 10, 2013 2:39 am

Re: Batch printing - prepared report

Mensaje por nbatocanin »

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

Código: Seleccionar todo

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 escribió:New install file: https://dl.dropboxusercontent.com/u/318 ... /frx15.exe

Please confirm it works as expected. TIA.
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9246
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

Re: Batch printing - prepared report

Mensaje por ignacio »

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]
https://www.xailer.com
nbatocanin
Mensajes: 42
Registrado: Sab Ago 10, 2013 2:39 am

Re: Batch printing - prepared report

Mensaje por nbatocanin »

ignacio escribió: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?
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9246
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

Re: Batch printing - prepared report

Mensaje por ignacio »

Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
https://www.xailer.com
nbatocanin
Mensajes: 42
Registrado: Sab Ago 10, 2013 2:39 am

Re: Batch printing - prepared report

Mensaje por nbatocanin »

Sorry, I still do not understand?
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9246
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

Re: Batch printing - prepared report

Mensaje por ignacio »

From the link given:

Another new operator - WITH OBJECT:

Código: Seleccionar todo

      WITH OBJECT expression
         ...
      ENDWITH

It allows to simplify the code for the reasonable use :

Código: Seleccionar todo

      // 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]
https://www.xailer.com
nbatocanin
Mensajes: 42
Registrado: Sab Ago 10, 2013 2:39 am

Re: Batch printing - prepared report

Mensaje por nbatocanin »

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

Código: Seleccionar todo

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 escribió:From the link given:

Another new operator - WITH OBJECT:

Código: Seleccionar todo

      WITH OBJECT expression
         ...
      ENDWITH

It allows to simplify the code for the reasonable use :

Código: Seleccionar todo

      // 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
Mensajes: 2
Registrado: Sab Mar 11, 2017 5:59 am

Re: Batch printing - prepared report

Mensaje por anser »

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)
Responder