Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
410 views
in Technique[技术] by (71.8m points)

sorting - can we set order to a table by wildcard in visual foxpro?

I am having a table in which I have to get the records having the word which I entered followed by the remaining records. (Sorting), I tried with "set filter to" but it is only showing the filtered records but I want all the records starting with the word containing ones


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

If you need the original table ordered in this way, create an index tag that sorts the ones with the word first, something like:

INDEX ON IIF('word'$field, 1, 2) TAG WordFirst

If a copy of the data will do, use a query something like:

SELECT IIF('word'$field, 1, 2) AS WordFirst, *  ;
  FROM YourTable ;
  ORDER BY 1 ;
  INTO CURSOR csrWordFirst

What's nice about the second version is that you can add other fields to the sort order, so that you can sort within the records with and the records without the word.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share

2.1m questions

2.1m answers

62 comments

56.6k users

...