Subject Re: indexing with character numbers
From Ken Mayer <dbase@nospam.goldenstag.net>
Date Sun, 26 Jan 2025 13:43:22 -0800
Newsgroups dbase.getting-started

On 1/26/2025 11:19 AM, Charlie wrote:
> Thanks Mervyn...  I hadn't looked at your first response closely, but after doing so a light went on in the back of my head!  it works great now.
>
> replace all id with str(val(id),12,0)
>
> use collection exclusive
> index on category+id tag test
> use collection order test

You're doing way more work than you need to. If the ID field is character:

index on category+val(id) tag test

Should work.

If the field is numeric:

index on category+val( str( id, 12, 0 ) ) tag test

should do the trick (using the STR() function to make everything a
string, and then take the value of that ...

But if you're happy with your solution, then okay.

Ken

--
*Ken Mayer*
Ken's dBASE Page: http://www.goldenstag.net/dbase
The dUFLP: http://www.goldenstag.net/dbase/index.htm#duflp
dBASE Books: http://www.goldenstag.net/dbase/Books/dBASEBooks.htm
dBASE Tutorial: http://www.goldenstag.net/dbase/Tutorial/00_Preface.htm
dBASE Web Tutorial: http://www.goldenstag.net/dbase/WebTutorial/00_Menu.htm
dBASE DOS to Windows Tutorial:
http://www.goldenstag.net/dbase/DtoWTutorial/00_Menu.htm