Subject Re: indexing with character numbers
From Charlie <tm@tc.com>
Date Mon, 27 Jan 2025 17:47:37 -0500
Newsgroups dbase.getting-started

Hi Ken..  I tried  'index on category+val( str( id, 12, 0 ) ) tag test'

But it didn't seem to work.  Although I could have done something wrong.  I am not replacing all.  I am only replacing when the user enters new data.  It seems to work well.  Thanks for your help.

Ken Mayer Wrote:

> 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