Página 1 de 1

Batch printing - prepared report

Publicado: Mar Oct 28, 2014 4:59 pm
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

Batch printing - prepared report

Publicado: Mié Oct 29, 2014 9:40 am
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,

Re: Batch printing - prepared report

Publicado: Vie Dic 02, 2016 4:38 pm
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.

Re: Batch printing - prepared report

Publicado: Mié Dic 07, 2016 12:50 pm
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,

Re: Batch printing - prepared report

Publicado: Jue Dic 08, 2016 12:33 am
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 4243 veces

Re: Batch printing - prepared report

Publicado: Jue Dic 08, 2016 4:11 am
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.

Re: Batch printing - prepared report

Publicado: Vie Dic 09, 2016 11:33 am
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,

Re: Batch printing - prepared report

Publicado: Vie Dic 09, 2016 3:47 pm
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)

Re: Batch printing - prepared report

Publicado: Vie Dic 09, 2016 4:27 pm
por ignacio
Hello,

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

Regards,

Re: Batch printing - prepared report

Publicado: Vie Dic 09, 2016 6:21 pm
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.

Re: Batch printing - prepared report

Publicado: Lun Dic 19, 2016 1:23 am
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

Re: Batch printing - prepared report

Publicado: Lun Dic 19, 2016 10:52 am
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

Re: Batch printing - prepared report

Publicado: Mar Dic 20, 2016 2:35 am
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

Re: Batch printing - prepared report

Publicado: Mar Dic 20, 2016 10:03 am
por ignacio
New install file: https://dl.dropboxusercontent.com/u/318 ... /frx15.exe

Please confirm it works as expected. TIA.

Re: Batch printing - prepared report

Publicado: Mar Dic 20, 2016 3:24 pm
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.

Re: Batch printing - prepared report

Publicado: Mar Dic 20, 2016 4:34 pm
por ignacio
Hello,

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

Regards,

Re: Batch printing - prepared report

Publicado: Mié Dic 21, 2016 4:35 pm
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?

Re: Batch printing - prepared report

Publicado: Mié Dic 21, 2016 8:19 pm
por ignacio

Re: Batch printing - prepared report

Publicado: Jue Dic 22, 2016 3:28 am
por nbatocanin
Sorry, I still do not understand?

Re: Batch printing - prepared report

Publicado: Jue Dic 22, 2016 1:08 pm
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

Re: Batch printing - prepared report

Publicado: Jue Dic 22, 2016 8:15 pm
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

Re: Batch printing - prepared report

Publicado: Mié May 10, 2017 11:03 am
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)