FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Reportclass -> Printing selected Records from xBrowse ?
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Reportclass -> Printing selected Records from xBrowse ?
Posted: Fri Oct 12, 2012 09:26 PM
Hello,

I want to print Records, defined in a xBrowse-selected-array
After a printed line, I have to skip to the next defined record.

The array < aSelected > includes the selected records from xBrowse
I tested :
..
10 Fields to be printed (1)->First_Value, (1)->Second_Value .....
..
nField := 1
COLUMN TITLE "Column 1" DATA (1)->First_Value FONT 2
END REPORT
oReport:bSkip := {|| nField++, DBGOTO(aSelected[nField]) }
ACTIVATE REPORT oReport WHILE nField <= len(aSelected)
RETURN NIL

It doesn't work.
Is there maybe still another Solution ?

Best Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 368
Joined: Sun May 31, 2009 06:25 PM
Re: Reportclass -&gt; Printing selected Records from xBrowse ?
Posted: Fri Oct 12, 2012 10:47 PM
I´m not sure I understood exactly what you want to do but I´d try something like that:
Code (fw): Select all Collapse
(1)->( dbGoTop() )
COLUMN TITLE "Column 1" DATA (1)->First_Value,(1)->Second_Value...,(1)->Last_Value, FONT 2
END REPORT
ACTIVATE REPORT oReport FOR ( aScan( aSelected, (1)->( recNo() ) ) > 0 )


or

Code (fw): Select all Collapse
nField := 1
COLUMN TITLE "Column 1" MySay( aSelected[ nField ] ) FONT 2
END REPORT
oReport:bSkip := {|| nField++ }
ACTIVATE REPORT oReport WHILE nField <= len(aSelected)

FUNCTION MySay( nReco )
(1)->( DBGOTO( nReco ) )
RETURN (1)->First_Value + " " + (1)->Second_Value..., + " " + (1)->Last_Value


Second way is obviously much faster.
Regards,



André Dutheil

FWH 13.04 + HB 3.2 + MSVS 10
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Reportclass -&gt; Printing selected Records from xBrowse ?
Posted: Fri Oct 12, 2012 11:07 PM

André,

Thank You for the response.
It seems to be the Solution, I'm looking for.
I will test it tomorrow.

What I want :
1. ) I select Records in xBrowse.
The Record-numbers are stored to a array.
2. ) Next I use a < Print-button > to print the selected Records as
a structured table and some calculations.
I need a defined Format, that is the reason to use the report-class.

Best Regards
Uwe :lol:

Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 2170
Joined: Fri Jul 18, 2008 01:24 AM
Re: Reportclass -&gt; Printing selected Records from xBrowse ?
Posted: Sat Oct 13, 2012 03:13 AM
Dear ukoenig.
This code is working for me. Please try it and tell me. Maybe this is what you are looking for.
Code (fw): Select all Collapse
//-----------------------------------------------//
Function PrintASelected(aSelected,MyTable)
local nRec, oReport, nLen:=len(aSelected)

REPORT oReport TITLE "SELECTED ITEMS" PREVIEW
    COLUMN TITLE "DESCRIP1" DATA (MyTable)->Field1
    COLUMN TITLE "DESCRIP2" DATA (MyTable)->Field2
    COLUMN TITLE "DESCRIP3" DATA (MyTable)->Field3
    COLUMN TITLE "DESCRIP4" DATA (MyTable)->Field4
END REPORT
oReport:bInit:= {||  nRec:=1, (MyTable)->(DbGoTo(aSelected[nRec])) }
oReport:bSkip := {|| if(nRec<nLen, (nRec++,  (MyTable)->(DbGoTo(aSelected[nRec]))), nRec:=nLen+1) }
ACTIVATE REPORT oReport WHILE nRec <= nLen
Return nil

Best regards.
Francisco J. Alegría P.

Chinandega, Nicaragua.



Fwxh-MySql-TMySql
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Reportclass -&gt; Printing selected Records from xBrowse ?
Posted: Sat Oct 13, 2012 08:32 PM

Francisco,

Thank You very much.
I tested Your solution and it works fine.

Best Regards
Uwe :lol:

Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.

Continue the discussion