Página 1 de 1

Custom code in a REPORT

Publicado: Mar Ene 08, 2013 9:33 am
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

Custom code in a REPORT

Publicado: Mar Ene 08, 2013 12:01 pm
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

Custom code in a REPORT

Publicado: Mar Ene 08, 2013 10:06 pm
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

Custom code in a REPORT

Publicado: Mié Ene 09, 2013 10:39 am
por ignacio
Hello,
Check TRptColumn:OnAddToTotal event.
Regards,

Custom code in a REPORT

Publicado: Mié Ene 09, 2013 6:29 pm
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