FoxPro is faster than you think.

REPLACE ALL (placeholderfield) WITH RECNO()

is practically instantaneous, for reasonable values of instant.



On Wed, Nov 19, 2014 at 2:02 PM, Rafael Copquin <rcopq...@fibertel.com.ar>
wrote:

> I am pulling a set of records from a big table, based on a filter
> condition in the select statement.
> I also want to create a field with the sequential number of those records.
>
> Example:
>
> select *, (function to number records) as recnbr from bigtable where
> filtercondition into cursor curFiltered readwrite
>
> What I need is a function or method to fill the recnbr field with
> sequential numbers, starting at 1 such that the resulting filtered set
> looks like:
>
> coname            city                  recnbr
> Widgets inc     New York            1
> John Doe's       New York            2
> etc
>
> The filter is the city (New York) and the table has more than one million
> records
>
> I know I could select the recnbr field as zero and then use a scan endscan
> construct to replace it with the numbers, like
>
> nRec = 0
> select curFiltered
> scan all
>        nRec = nRec + 1
>        replace recnbr with nRec
> endscan
>
> But I wonder if it would not be much faster if the record numbers came
> directly calculated in the select statement
>
> Rafael Copquin
>
>
[excessive quoting removed by server]

_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/CACW6n4s1Riqc98FZV4-H4CVdkbPSTpGh=2MN_TbhKh1uwY=k...@mail.gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to