Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Filter and Index help - PLEASE.
Message
From
19/05/1999 11:26:42
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
19/05/1999 11:16:01
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00220283
Message ID:
00220461
Views:
25
Forgive my ignorance, date was another field.
Then I would construct the index as :
emp_num + dtos(date) + padl(start_time,5,"0")
Which would make the filter fully optimizable :
set filter to emp_num + dtos(date) + padl(start_time,5,"0") = 'xxxxxx' + dtos({xx/xx/xx})
with set exact off. Even to make it faster, instead of "set filter" :
set order to tag newIndex && newIndex - emp_num + dtos(date) + padl(start_time,5,"0")
set key to 'xxxxxx' + dtos({xx/xx/xx})
Cetin

>The start_time field is just a numeric field that represents the time in 24-hour decimal-hour format.
>
>For instace:
>
>8:15 a.m. is stored as 8.25
>
>
>
>>>I have a TIME CLOCK app in VFP6 using free tables.
>>>
>>>the table structure is
>>>
>>>emp_num (c6)
>>>start_time (N5.2)
>>>stop_time (N5.2)
>>>date (Date)
>>>
>>>I have an index on emp_num and date.
>>>
>>>In the app, I do this:
>>>
>>> use time_clock order emp_num
>>> set filter to emp_num='xxxxxx' and date={xx/xx/xx}
>>>
>>>to see a particular employees time records for a particular day.
>>>
>>>Usually, the records are entered sequentially, such that the order of the records is automatically in chronological order with respect to the "start_time".
>>>
>>>However, sometimes records will be added so that they are NOT in order by "start_time" as entered.
>>>
>>>So, I modified the emp_num index tag be "emp_num+str(start_time,5,2)"
>>>
>>>
>>>Now then, is this a good way? Please advise better method (using free tables).
>>Change your index expression to :
>>if starttime is date
>>
emp_num+dtos(starttime)
>>if starttime is datetime
>>
emp_num+ttoc(starttime,1)
Also you could add "descending" keyword if wat to see last entries first.
>>Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform