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.

Custom code in a REPORT

Xailer professional forum in English
Responder
ChrisGillard
Mensajes: 384
Registrado: Mar May 01, 2007 5:49 pm

Custom code in a REPORT

Mensaje por ChrisGillard »

Hi,
In a REPORT, I am wanting to add some code to print details from a 'child' dbf in a report ..... something like Ignacio has done in this recent addition to xDbu.


Is this done with the PrintAtCol() method maybe in the OnPostPage event which should be after any page totals?
An example of something similar would be very useful.
Thanks
Chris


Attached files
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9447
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

Custom code in a REPORT

Mensaje por ignacio »

A portion of the code:
WITH OBJECT oReport
:OnPostEnd := {|| MoreInfo( oReport, ::oDataset ) }
END WITH
RUN REPORT oReport
....
STATIC FUNCTION MoreInfo( oReport, oDataset )
LOCAL aTags
LOCAL cBag, cTag
LOCAL nLen, nTag, nPix
aTags := oDataset:GetTags( .F., .F. )
cBag := ""
nLen := Len( aTags )
nPix := oReport:nLineHeight / 2
WITH OBJECT oReport
:NewLine()
:StartLine()
:PrintAtCol( 1, "...", taLEFT, 2,, 5000 )
:EndLine()
END WITH
RETURN NIL
Ignacio Ortiz de Zúñiga
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
ChrisGillard
Mensajes: 384
Registrado: Mar May 01, 2007 5:49 pm

Custom code in a REPORT

Mensaje por ChrisGillard »

Hi Ignacio,
Thank you for the example code.
I have got it working with my child dbf records printing below each 'parent record' using the report skip block.
oReport:bSkip := { || MailBoxStuff( oReport ), XDOMAIN->( dbskip() ) }
In an ideal world the only thing I would have liked to do is add some child line values into a Total column in the main report from my MailBoxStuff function .... but a oRptColumn:nTotal is READONLY.
Unless there is another way of adding into a oRptColumn:nTotal manually then I would vote for it being ! READONLY or having a method like oRptColumn:AddToTotal( nValue ) which I could use.
Just a thought.
Anyway thanks again for your help.
Chris
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9447
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

Custom code in a REPORT

Mensaje por ignacio »

Hello,
Check TRptColumn:OnAddToTotal event.
Regards,
Ignacio Ortiz de Zúñiga
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
ChrisGillard
Mensajes: 384
Registrado: Mar May 01, 2007 5:49 pm

Custom code in a REPORT

Mensaje por ChrisGillard »

Hi Ignacio,
OnAddToTotal event .... I missed that when looking around.
That sounds like the sort of thing I am looking for.
Thanks for your help.
Chris
Responder