Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9142047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:43:33+00:00 2026-06-17T09:43:33+00:00

I have a delphi application that uses tdbf which is based on tdataset with

  • 0

I have a delphi application that uses tdbf which is based on tdataset with the advantage of not requiring bde engine. I needed the table to be sorted and I did this one a single field by adding an indexdef and then specifying the indexfieldnames.

I am trying to now get it to sort on 2 fields ie group men together and then women together and then have each group sorted on salary so that we see females from lowest earner to highest earner followed by men in the same way.

I have read every piece of material stating that you simply specify sortfield of the indexdef as ‘gender+salary’. When I try use the index I get told that ‘+’ is not a valid fieldname. I have tried every delimeter from ‘.’. ‘,’. ‘&’ and ‘;’. Every delimeter gets picked up as a field that doesn’t exist. What is the correct way to sort a table on multiple fields?

Thanks in advance
Clinton Brits

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T09:43:33+00:00Added an answer on June 17, 2026 at 9:43 am

    xBASE (dBASE and it’s derivatives) requires that fields in an index all be converted to the same data type, typically strings. To do that typically requires some common functions:

    • DTOS() – Converts an xBASE date to the format CCYYMMDD as a string
    • STR() – Converts a numeric to a string, with an optional width specifier (default 10) and number of digits to the right of the decimal point. Specifically, the syntax is specified as STR(<numeric> [, <width> [, <decimaldigits>] ]).
    • SUBSTR() – Extracts a portion of a string from another, with a specified starting position and number of characters
    • IIF() – Immediate IF, used to convert logicals (eg., IIF(Married = .T., 'Y', 'N')

    Index expressions are indeed combined with the + operator. The error you’re receiving is probably because you haven’t converted to a common data type.

    As you’ve specified the Gender column (probably defined as CHAR 1) and Salary column (probably a NUMERIC of some size), you can use something like

    Dbf1.AddIndex('GENDER_SAL', 'GENDER + STR(SALARY, 10, 0)', []);
    

    This creates a index on an expression like F 10000, F 200000, M 12000, where SALARY is converted to the default width of 10 characters (left padded with spaces) and no decimal digits. This should work for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Background: I have an application written in Delphi that uses the Borland Database Engine
I have a Delphi 6 application that uses the Indy 9 components to maintain
I have an ISAPI Application in Delphi 6 that uses WebBroker. I need to
I have a Delphi application that uses ShellExecute to call a second Delphi Application
I have a Delphi (5) application that uses a log-in screen (standard user name/password)
I have an application that uses Rave Reports on Delphi 7. I want the
I have customer that uses older, custom built ERP application for which they don't
I am using Delphi 7 on Windows 7 and have an application which uses
I have a Delphi 6 application that uses the DSPACK component library. That library
I have an old Delphi application that uses the SAP ActiveX SAPFunctions var TmpSAPFunctions:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.