Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Set Near - Question
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00057940
Message ID:
00057970
Views:
27
>Hello,
>
>I have a table "student" that tracks which day a particular student takes a lesson, what time, which room, and with which instructor. In other words the pertinent fields are stu_day, stu_room, stu_bgntime and stu_endtime.
>
>I have an index that is called stu_day which is str(stu_day)+stu_room+str(stu_bgntime).
>
>Lets say I have a student scheduled for day 1, room 1 , and from 1:00pm to 2:00pm.
>
>My problem is ... that if I set order to stu_day and do a seek on day 1, room 1 and bgntime of 1:30 I would like this particular student to be selected, However the index is set on stu_bgntime so this student will not be selected. If I "Set Near on" it will find the next record. Is there a way to do a find <= on an index in VFP. Or is the best way to do this to "Set Near On" and then if !found() do a seek -1 and then do some checking to make sure the time is "Between" stu_bgntime and stu_endtime and the day and room are correct?
>
>Sorry if this is a stupid question.

I have a similar situation for which I must seek on 3 values, 2 of which are known and the third falling within a range. Basically, you can't use SEEK for a situation like this, so I use LOCATE FOR, and use the 3 different parameters. If you have indexes on all of the values you LOCATE on, it will work pretty quickly, but not nearly as quickly as it would be with a seek. On a table on the network with about 400,000 records, this locate line takes about 4 seconds. I would be interested to hear if there is a better solution.

quote from NFL commercial:
"There is no such thing as a stupid question. Just stupid people asking questions."

Really though, the only stupid question is one asked before even attempting to think through the answer one's self. Your's is not a stupid question.

Erik
Erik Moore
Clientelligence
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform