Hello,
Why this:
Lista2:aCols[1]:cFooter := { || Ltrim( Str( Lista2:KeyNo() ) ) + " / " + LTrim( Str( Lista2:KeyCount() ) ) }
Lista2:Refresh()
Show me {||...} in footer?
Thanks in advance.
Hello,
Why this:
Lista2:aCols[1]:cFooter := { || Ltrim( Str( Lista2:KeyNo() ) ) + " / " + LTrim( Str( Lista2:KeyCount() ) ) }
Lista2:Refresh()
Show me {||...} in footer?
Thanks in advance.
wartiaga wrote:Hello,
Why this:
Lista2:aCols[1]:cFooter := { || Ltrim( Str( Lista2:KeyNo() ) ) + " / " + LTrim( Str( Lista2:KeyCount() ) ) }
Lista2:Refresh()
Show me {||...} in footer?
Thanks in advance.
Lista2:aCols[1]:bFooter := { || Ltrim( Str( Lista2:KeyNo() ) ) + " / " + LTrim( Str( Lista2:KeyCount() ) ) }cnavarro wrote:wartiaga wrote:Hello,
Why this:
Lista2:aCols[1]:cFooter := { || Ltrim( Str( Lista2:KeyNo() ) ) + " / " + LTrim( Str( Lista2:KeyCount() ) ) }
Lista2:Refresh()
Show me {||...} in footer?
Thanks in advance.
Use this
Lista2:aCols[1]:bFooter  := { || Ltrim( Str( Lista2:KeyNo() ) ) + " / " + LTrim( Str( Lista2:KeyCount() ) ) }
oBrw:aCols[ 1 ]:nFooterType := AGGR_COUNT
oBrw:aCols[ 1 ]:bSumCondtion := { |v,o| ( oBrw:cAlias ) -> ( !Deleted() ) }USE MYTABLE ....
SET FILTER TO !DELETED()
GO TOP
// over and above this, we can use Scopes also.
// now build xbrowseSET FILTER TO AGE > 47 .AND. !DELETED()cnavarro wrote:Try with
oBrw:aCols[ 1 ]:nFooterType := AGGR_COUNT oBrw:aCols[ 1 ]:bSumCondtion := { |v,o| ( oBrw:cAlias ) -> ( !Deleted() ) }
nageswaragunupudi wrote:oBrw:KeyCount() is the same as ( oBrw:cAlias )->( OrdKeyCount() )
OrdKeyCount() is a (x)Harbour function.
By default OrdKeyCount() respects Scopes and Filters but includes deleted records also. This is what we all should know.
If we want OrdKeyCount() not to include deleted records, we should set filter to "SET FILTER TO !DELETED()"
If we are particular that oBrw:nLen or oBrw:KeyCount() should not include deleted records then
USE MYTABLE .... SET FILTER TO !DELETED() GO TOP // over and above this, we can use Scopes also. // now build xbrowse
If we want to set some filter like "AGE > 40", then set filter like this:
SET FILTER TO AGE > 47 .AND. !DELETED()
OrdKeyNo() also is effected in the same way.
Note:
1. Using oBrw:nLen is faster than using oBrw:KeyCount().
2. These are issues relating to using the (x)Harbour function OrdKeyCount() but not XBrowse.
Thank you Mr. Nages, I use ! Deleted() in index condition to solve this issue.
INDEX ON DELETED() TAG DELETED#include "Fivewin.ch"
REQUEST DBFCDX
FUNCTION MAIN()
LOCAL nSec
LOCAL n, i
RDDSETDEFAULT( "DBFCDX" )
SET OPTIMIZE ON
DBCREATE( "MYTEST", { { "TEST", "C", 100, 0 } } )
USE MYTEST
FOR i = 1 TO 300000
APPEND BLANK
REPLACE FIELD -> test WITH "TEST" + LTRIM( STR( i ) )
IF i % 2 = 0
DELETE
ENDIF
NEXT
INDEX ON FIELD -> test TAG TEST TO MYTEST FOR !DELETED()
nSec = SECONDS()
n = 0
WHILE !EOF()
n++
SKIP
ENDDO
? n, SECONDS() - nSec
CLOSE
FERASE( "MYTEST.CDX" )
USE MYTEST
INDEX ON DELETED() TAG DELETED TO MYTEST
INDEX ON FIELD -> test TAG TEST TO MYTEST
SET FILTER TO !DELETED()
nSec = SECONDS()
n = 0
WHILE !EOF()
n++
SKIP
ENDDO
? n, SECONDS() - nSec
CLOSE
FERASE( "MYTEST.DBF" )
FERASE( "MYTEST.CDX" )
RETURN NILRao, have you had the time to test my sample?
EMG