Solved

Order By in Visual Fox Pro  6.0

Posted on 2011-03-09
3
659 Views
Last Modified: 2012-05-11
Hello Experts,

I have code like this:

Code Snippet:
IF USED("Results")
      SELECT Results
ELSE
      SELECT 0
      USE Results
ENDIF
CURSORSETPROP("buffering",3)


 I need the Results table(or DBF) file to be Order by Datetime, since the table contains the datetime field.

How can I do that in Fox Pro 6.0
0
Comment
Question by:ASPDEV
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 1

Expert Comment

by:hiraben
ID: 35088096
Any of these:

1) You can use: select * from results order by datetime --> this won't be updatable (changes won't be saved)
2) you can use: sort to results_ordered on datetime
3) you can create a local view on the results table and set the order to datetime. This requires creating a database, but it is the best solution because it is updateable
0
 
LVL 42

Accepted Solution

by:
pcelba earned 500 total points
ID: 35088233
The easiest thing you can do is INDEX.

SELECT Results
INDEX ON datetimeField TO (SYS(2023)+"\TmpIndex") COMPACT

and from now the table is ordered as you need. This kind of index is a bit temporary and it is not updated by other instances which use same DBF. If you need something more "permanent" and updated from all users then you should add index tag into the structural index file:

USE Results EXCLUSIVE
INDEX ON datetimeField TAG SomeName
USE

And from now when you need the table ordered by datetimeField simply issue:

SET ORDER TO TAG SomeName

The tag name must be up to 10 characters. You may also decide about the ascending or descending order.
0
 

Author Closing Comment

by:ASPDEV
ID: 35088573
Excellent!

Thanks,
ASPDEV
0

Featured Post

Understanding Linux Permissions

Linux for beginners: How to view the permissions associated with files and directories and also how you can change them.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month4 days, 10 hours left to enroll

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question