INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Descending indexes

Descending indexes

(OP)
I am using an aftermarket index driver. I need to create a descending date index. In clipper they had a option on index on to do this, but it is not supported with this driver. I have written it programatically in the past but I do not remember how I did it, any suuugestions where to start?????

RE: Descending indexes

Pick a date a long way in the future and make the order work like this

CODE

INDEX ON STR(CTOD("12/12/2099")-MyDateField,8,0) TAG MyTagName

You might need to consider the date formatting!

Regards

Griff
Keep ing

RE: Descending indexes

Don't rule out the DESCEND() function either!

HTH
TonHu

RE: Descending indexes

(OP)
Thank you much. I was thinking it was something simple, but I got a little rusty with my programming since I only do it about once a month or so.

RE: Descending indexes

Trinkertom,

All of those ideas are good and should work.  You could also break out the pieces of the date and subtract them from 9999 for the year or 99 for the day and month which will get you to the same place that Griff is suggesting, only needed if there is some conflict going on.  The cleanest way is to use the descend function as TonHu suggests.   

Jim C.

RE: Descending indexes

I *forgot* the descending function - as I do most of my work in VFP and it doesn't have one !

sad shades

Regards

Griff
Keep ing

RE: Descending indexes

Griff,

It's all good. I'm still stuck in Clipper 5.2e,  I came in with Clipper and I'll probally go out with Clipper.

Jim C.

RE: Descending indexes


Griff,

I *forgot* the descending function - as I do most of my work in VFP and it doesn't have one !
Guess what? It does! At least versions 6.0-9.0.

CODE

DESCENDING() Function

Returns a logical value that indicates whether an index tag was created with the DESCENDING keyword or whether the DESCENDING keyword was included in USE, SET INDEX, or SET ORDER.

Syntax

DESCENDING([CDXFileName,] nIndexNumber [, nWorkArea | cTableAlias])

Yes, I know, I didn't remember it, too, I don't use it in VFP; I just checked the Help. I cannot find it in the old FoxPro (2.0?) manual, though. And I don't remember it from Clipper, too, since the last one I used was Clipper Summer'87 some 12 or more years ago (was it there, in '87 version?).


RE: Descending indexes

It's not the same Stella

In Clipper you could apply DESCENDING() to anything, in VFP an index is either ASCENDING or DESCENDING - the WHOLE index.

In Clipper you could play a little:

CODE

index on MyFirstField+DESCENDING(MySecondField)+MyThirdField ...

I don't *think* you can do that in VFP... can you?

happy shades

Regards

Griff
Keep ing

RE: Descending indexes


I don't know.
I've never tried.
According to the description in Help, probably you can't.
But for that matter, I didn't remeber what you could do with it in Clipper - or even that it existed. (I said it was long ago.) Thanks for the refresher - good example.

RE: Descending indexes

Dooh, typing bad too!

Regards

Griff
Keep ing

RE: Descending indexes

(OP)
I used griffmg's suggestion and it worked perfectly. I had used it before 15 years ago but forgot it. I use the Success index drivers so descend() does not work. The indexes are very compact and fast with this addin, and it has never been a problem.
I am with jcreamerII on Clipper. I have used it from inception and only maintain my own Clipper programs, so no need to change.
I have VFP that I am trying to learn, but it is radically different in a lot of respects. I have played with C++ some over the years, but always fall back on good ol' Clipper!

Thanks for everyones help. Tom

RE: Descending indexes

Good luck to you Tom.

I do a LOT of my work in VFP 5/6/9 now, it is very good indeed and well worth making the move for.

Lots of help on Tek-Tips with it too.

Regards

Griff
Keep ing

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close