Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Reccount() counts the deleted items
Message
From
03/03/2000 14:13:28
 
 
To
03/03/2000 12:34:42
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00341313
Message ID:
00341405
Views:
26
>Hi everyone,
>
>It just occured to me that when I use the reccount() function or an SQL count function it counts the deleted entries (the ones with their "squares" black) and I don't want those included in my totals.
>
>Do I have to write a separate function or is there an existing command (something like SET DELETES OFF) that I can use in order to count ONLY the entries that are not deleted?
>

If there's an index on DELETED():
FUNCTION CountUndeleted
LPARAMETER cAlias
LOCAL cInAlias, cOrder, cDeleted, nRecPos, nDeleteCount, nResult
IF USED(cAlias)
   cInAlias = ALIAS()
   SELECT(cAlias)
   cOrder = cOrder
   cDeleted = SET('DELETED')
   nRecPos = RECNO()
   SET DELETED OFF
   SET ORDER TO 0
   COUNT FOR DELETED() TO nDeleteCount
   nResult = RECCOUNT() - nDeleteCount
   IF cDELETED = 'ON'
      SET DELETED ON
   ENDIF
   IF nRecPos # 0
      GO nRecPos
   ENDIF
   IF ! EMPTY(cOrder)
      SET ORDER TO &cOrder
   ENDIF
   IF ! EMPTY(cInAlias)
      SELECT (cInAlias)
   ELSE
      SELECT 0
   ENDIF
   RETURN nResult
ELSE
   RETURN NULL
ENDIF
>And if I have to write a function, what kind of conditions have to be included in it?
>
>Thanks a lot in advance, Steph.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform