Silvio.Falconi wrote:artu01 wrote:
Silvio:
at the beginning, ncounter should be 0
Dear artu01,
I have been looking for solutions for a week, turning the forum many times and all my saves from 1992 to today, from fw14.4 to the penultimate 32-bit version of 2020,
unfortunately I can't try the 16-bit exes because I have to find old 16-bit PCs and they are easy to find, but believe me I don't remember having problems with this bug
on this topic
http://forums.fivetechsupport.com/viewt ... er#p110839 Mr NagesWarao explain how we must make
there is also a sample , it run for bfor condition but when you try to insert a group not run
I used his test sample and I insert group command
Code: Select all
#include 'fivewin.ch'
#include 'report.ch'
REQUEST DBFCDX
function Main()
local cAlias, oWnd
if ( cAlias := OpenData() ) != nil
DEFINE WINDOW oWnd
ACTIVATE WINDOW oWnd HIDDEN ;
ON INIT ( ( cAlias )->( Report() ), oWnd:End() )
endif
( cAlias )->( DbCloseArea() )
return nil
function Report()
local oRep, oFont,oFont2
local cAlias := Alias(), nCounter := 0
DEFINE FONT oFont NAME 'TAHOMA' SIZE 0,-9
DEFINE FONT oFont2 NAME 'TAHOMA' SIZE 0,-10 bold
DEFINE PEN oPen1 WIDTH 1
DEFINE PEN oPen2 WIDTH 1
REPORT oRep FONT oFont,oFont2;
PEN oPen1,;
oPen2 ;
PREVIEW
COLUMN DATA nCounter TITLE "Number" PICTURE '9999' TOTAL
COLUMN TITLE "UNIT" DATA 1 PICTURE "999" TOTAL
COLUMN TITLE "First" DATA ( cAlias )->FIRST SIZE 20
COLUMN TITLE "State" DATA ( cAlias )->STATE SIZE 5
COLUMN TITLE "Age" DATA ( cAlias )->AGE PICTURE "9999" RIGHT
COLUMN TITLE "Salary" DATA ( cAlias )->SALARY PICTURE "99,999,999.99" RIGHT TOTAL
GROUP ON ( cAlias )->STATE ;
FOOTER space(40)+"Total State "+oRep:aGroups[1]:cValue+ ;
" ("+ltrim(str(oRep:aGroups[1]:nCounter))+")" ;
FONT 2
ENDREPORT
oRep:bFor := { || If(( cAlias )->SALARY > 25000 , (nCounter++, .t. ), .f. ) }
ACTIVATE REPORT oRep ;
ON ENDPAGE ( oRep:aColumns[ 1 ]:nTotal := nCounter ) ;
ON END ( oRep:StartLine(), oRep:EndLine(), oRep:StartLine(), ;
oRep:Say(1, 'Total customers: '+Tran(oRep:nCounter, '@E 999,999'), 1),;
oRep:EndLine() )
RELEASE FONT oFont
return nil
static function OpenData()
local cAlias, lOpen := .f.
cAlias := cGetNewAlias( "CUST" )
USE c:\work\FWH\samples\customer.dbf ;
NEW ALIAS (cAlias) SHARED VIA 'DBFCDX'
index on (cAlias)->state tag 1 temporary
lOpen := Select( cAlias ) > 0
return If( lOpen, cAlias, '' )
the condition
oRep:bFor := { || If(( cAlias )->SALARY > 25000 , (nCounter++, .t. ), .f. ) } is not execute
each total group is ok and also oRep:nCounter for each group
at the end the oRep:nCounter is 500