Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grids... Record x of xyz?
Message
 
 
To
15/06/2001 14:33:49
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00519547
Message ID:
00520104
Views:
17
>So you have an idea to get the number of records within a filtered cursor? Fast simple and so on?
>
>My customer asks all the time, and I just ignore it ...
>
>
>Thank you for Help
>
>Lutz
Off the top of my head:
local lcFor, lnRecno, lcFilter, lcOrder, lcWhere
select yourtable
lnRecno=recno()
lcFilter=filter()
if !empty(m.lcFilter)
    lcWhere=m.lcFilter
endif
lcOrder=order()
if !empty(m.lcOrder)
   lcFor=for(tagno(m.lcOrder)) && Might be filtered index as well
endif
if !empty(m.lcFor)
   lcWhere=m.lcWhere+iif(!empty(m.lcWhere)," and ","")+m.lcFor
endif
if !empty(m.lcWhere)
   count for &lcWhere to thisform.NumberOfRecords && Attention, this might be slow, if FOR condition not optimizable and you have lots of records in the table
else
  if set('deleted')="ON" && this affects number of records as well, if you have deleted records in the table
    count to thisform.NumberOfRecords 
  else
   thisform.NumberOfRecords=reccount()
  endif
endif 
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform