Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sorting a keyed table

Status
Not open for further replies.

woodyinoz

IS-IT--Management
Jan 8, 2002
215
GB
Hi all,

I am trying to sort a keyed table on something other than the keyed fiedls and I want the result to remain in the keyed table, not sorted to a different table. I want this to happen on one form only... Is there something I can do to make this happen?

Thanks in advance,

Woody
 
You can't sort the table differently without removing keys, but you can view the table through a form with records ordered differently.

Restructure table and create a secondary, maintained, index on the required sort field(s). This index can be composite on a number of fields if you need this.

Open the form in design mode. View the Data Model. On the table in the Data Model, right-click and select Filter...

There should be an "Order By" check box and a list of indices below this. Tick the box and select required index.

When run, this form should now display records in the selected order.

Regards,
 
I would try adding a secondary index to the table, then using switchIndex() on the form to display the data in the order created by the alternative index. The switchIndex() example code is fairly straightforward.

Mac :)

"There are only 10 kinds of people in this world... those who understand binary and those who don't"

langley_mckelvy@cd4.co.harris.tx.us
 
Format > Sort > use a different table name in the interface. Open new table.
 
Woody,

The others have posted a number of alternatives, but the one that fits the needs of your post is the secondary index.

As you know primary keys do two things: they provide uniqueness between records and they sort the table.

When that initial sort isn't what you want, you create a secondary index containing the fields that give you the sort order you want.

If you're doing this with your form's primary table, e.g. the master table, you select the secondary index from the Filter dialog box. To do so:

1. Open your form in a View window. That is, not in a Design window.

2. Choose Record | Filter from the main menu (Paradox 10).

3. Place a checkmark in the Order By checkbox.

4. Highlight the secondary index you want to use in the list below the Order By checkbox.

5. Choose OK.

Your data should now appear in the order you want.

If you're doing this with a detail table, you need to:

a) Make sure the seoncdary index contains the linking field(s) as the first field(s).

b) Use the index as the linking index in your form's data model. To do this,

1) Open your form in a Design window.

2) Choose Format | Data model.

3) If necessary, drag the windows around so you can find the linking arrow connecting the detail table to your master table.

4) Double-click the linking arrow to open the Link Property dialog box.

5) Choose the secondary index from the Child Index list.

6) Choose OK, save your changes, and then run your form.

Your data should now sort properly.

Hope this helps...

-- Lance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top