TReport samples
TReport samples
Hi All!
Is it possible to report from more than one database, like each invoice or order with its line items ? All the samples given are for just one.
Is it possible to report from more than one database, like each invoice or order with its line items ? All the samples given are for just one.
Re: TReport samples
I know 2 ways:
Code: Select all
select invoice
REPORT oRepo TITLE ....
COLUMN TITLE "INVOICE Nº" DATA invoice->invoicenbr
COLUMN TITLE "PRODUCT NAME" DATA YourFunction( order->codproduct)
FUNCTION YourFunction( codproduct )
products->( ordsetfocus( "the right index"), dbseek( codproduct) )
return products->name
Code: Select all
products->( ordsetfocus( "the right index") )
invoice->( dbSetRelation("products", { || invoice->codproduct} ))
select invoice
REPORT oRepo TITLE ....
COLUMN TITLE "INVOICE Nº" DATA invoice->invoicenbr
COLUMN TITLE "PRODUCT NAME" DATA products->name
Regards,
André Dutheil
FWH 13.04 HB 3.2 BCC 5.82 MinGW 4.5.2 MSVS 10
André Dutheil
FWH 13.04 HB 3.2 BCC 5.82 MinGW 4.5.2 MSVS 10
Re: TReport samples
Is it possible to print different data on different rows, like 1 row - name, address, order # - after that several rows - items of the order?ADutheil wrote:I know 2 ways:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: TReport samples
Mosh,
In FWH/samples/report/repdemo.prg and rep*.prg there are a lot of very useful an easy TReport examples.
You can built it running go.bat and you should get repdemo.exe
In FWH/samples/report/repdemo.prg and rep*.prg there are a lot of very useful an easy TReport examples.
You can built it running go.bat and you should get repdemo.exe
Re: TReport samples
1) go.bat doesn t goAntonio Linares wrote:Mosh,
In FWH/samples/report/repdemo.prg and rep*.prg there are a lot of very useful an easy TReport examples.
You can built it running go.bat and you should get repdemo.exe
2) I did study all rep*.prg and didnt find my example. Can you please show such example?
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: TReport samples
Mosh,
What error do you get with go.bat ? What FWH version are you using ?
rep09.prg from FWH/samples/report shows how to use multiple lines in columns:
What error do you get with go.bat ? What FWH version are you using ?
rep09.prg from FWH/samples/report shows how to use multiple lines in columns:
Code: Select all
COLUMN TITLE "First Name", "Last Name" ;
DATA Test->First, Test->Last
COLUMN TITLE "Street", "City" ;
DATA Test->Street, Test->City
Re: TReport samples
Mosh,
I think you are looking for something like this:
I think you are looking for something like this:
Code: Select all
LOCAL cOrderNumber
LOCAL oRepo
details->( ordSetFocus( "ordered_by_order_number" ) )
REPORT oRepo TITLE "Master/Details" PREVIEW
COLUMN TITLE "NAME" DATA master->NAME
COLUMN TITLE "ADDRESS" DATA master->ADDR
COLUMN TITLE "ORDER" DATA SayOrderNumber( @cOrderNumber )
COLUMN TITLE "PRODUCTS" DATA "" SIZE 50
END REPORT
ACTIVATE REPORT oRepo ON CHANGE SayDetails( oRepo, cOrderNumber )
STATIC FUNCTION SayOrderNumber( cOrderNumber )
cOrderNumber := master->ORDN
RETURN master->ORDN
STATIC Function SayDetails( oRepo, cOrderNumber )
details->( ordScope( 0, cOrderNumber ), ordScope( 1, cOrderNumber ), dbGoTop() )
oRepo:BackLine( 1 )
WHILE details->( !eOF() )
oReport:StartLine()
oReport:Say( 4, details->FIELD_YOU_WANT )
oReport:EndLine()
details->( dbSkip() )
ENDDO
details->( ordScope( 0, NIL ), ordScope( 1, NIL ) )
oRepo:Newline()
RETURN NIL
Regards,
André Dutheil
FWH 13.04 HB 3.2 BCC 5.82 MinGW 4.5.2 MSVS 10
André Dutheil
FWH 13.04 HB 3.2 BCC 5.82 MinGW 4.5.2 MSVS 10
Re: TReport samples
Antonio,
With WINDOWS 7 seems that harbour can´t create the .\obj directory. But if you create it with md obj go.bat Works OK.
With WINDOWS 7 seems that harbour can´t create the .\obj directory. But if you create it with md obj go.bat Works OK.
Regards,
André Dutheil
FWH 13.04 HB 3.2 BCC 5.82 MinGW 4.5.2 MSVS 10
André Dutheil
FWH 13.04 HB 3.2 BCC 5.82 MinGW 4.5.2 MSVS 10
Re: TReport samples
Yes, exactly! Thanks. One more question : how can I draw a box around master row?ADutheil wrote:Mosh,
I think you are looking for something like this:
Re: TReport samples
Try with oRepo:Line( nTop, nLeft, nBottom, nRight, nPen, nScale )
Regards,
André Dutheil
FWH 13.04 HB 3.2 BCC 5.82 MinGW 4.5.2 MSVS 10
André Dutheil
FWH 13.04 HB 3.2 BCC 5.82 MinGW 4.5.2 MSVS 10
Re: TReport samples
I understand, but the question is how to determine nTop, nLeft, nBottom, nRight ?ADutheil wrote:Try with oRepo:Line( nTop, nLeft, nBottom, nRight, nPen, nScale )
Re: TReport samples
I you want a box better use box method:
Antônio can tell if there is better way but this works.
Code: Select all
oRepo:bStartRecord := { || oRepo:box( oRepo:nRow / oRepo:oDevice:nLogPixelY, oRepo:nMargin/oRepo:oDevice:nLogPixelX, ( oRepo:nRow + oRepo:nStdLineHeight) / oRepo:oDevice:nLogPixelY, RightMargin( oRepo ) / oRepo:oDevice:nLogPixelX , 1 ) }
FUNCTION RightMargin( oRepo )
LOCAL nRight := oRepo:nMargin
AEval( oRepo:aColumns, { | v | nRight += v:nWidth } )
nRight += ( ( Len( oRepo:aColumns )- 1 ) * oRepo:nSeparator )
RETURN nRight
Regards,
André Dutheil
FWH 13.04 HB 3.2 BCC 5.82 MinGW 4.5.2 MSVS 10
André Dutheil
FWH 13.04 HB 3.2 BCC 5.82 MinGW 4.5.2 MSVS 10
Re: TReport samples
Thanks!ADutheil wrote:I you want a box better use box method:
But in fact this sample draw boxes between rows not around them. I couldn't make it work as desired.
Re: TReport samples
The test I wrote seems OK:
Regards,
André Dutheil
FWH 13.04 HB 3.2 BCC 5.82 MinGW 4.5.2 MSVS 10
André Dutheil
FWH 13.04 HB 3.2 BCC 5.82 MinGW 4.5.2 MSVS 10
Re: TReport samples
Can you please post your entire sample? Also - I need all the master row for master info and start 1st detail row on next row.ADutheil wrote:The test I wrote seems OK: