?
Solved

DBLookupCombox (Sorting)

Posted on 2000-03-16
7
Medium Priority
?
235 Views
Last Modified: 2010-04-04
History:

I use a Dbtext component to create the Rqst_ID (which is autoincrement field)for example 18. I copy TNG-0- string into the Doc_id Dbtext component plus the Rqst_ID which gives me TNG-0-18.

The problem I am having is in the dblookupcomboxbox component, the Doc_Id is display like this below.


TNG-0-18
TNG-0-181
TNG-0-19
TNG-0-190
TNG-0-191

Is there a way I can sort in this order instead.

TNG-0-18
TNG-0-19
TNG-0-181
TNG-0-190
TNG-0-191

If this is not enough points let me know.

Thanks alot,

Angela
0
Comment
Question by:Angela030399
[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
7 Comments
 
LVL 5

Accepted Solution

by:
TheNeil earned 400 total points
ID: 2623971
No idea if this will work or not but you might have to copy the items from your DBLookupComboBox into a regular ComboBox and do the sort manually. There's no sort setting to specify HOW the items are sorted (it uses alphabetical) so I think you're going to have to do things manually (regardless of if you copy it to another combobox or if you can use the DBComboLookupBox). Alternatively if you can pad your Rqst_ID values with 0's then it'll do the job for you

e.g.

TNG-0-018
TNG-0-019
TNG-0-181
TNG-0-190
TNG-0-191

The Neil
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2624202
I think you have to sort it at the source. Fill the DBLookupComboBox by using a query that produres a result in the right order:

Select * from table order by somefield;
0
 

Expert Comment

by:Iamme
ID: 2624721
ok...you colud change the data tyoe of the fiel,,bacause ORDER BY.only sort by ord(q)....................and if you want to sort by number.........you should change data type to NUMBER...............

select * from table order by somefield;

It coul function if the fiels was an integere value
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 13

Expert Comment

by:Epsylon
ID: 2624850
>It coul function if the fiels was an integere value

Not true! How told you that?
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2624868
I mean you can sort on all types except blob and similar fields.
0
 

Expert Comment

by:evansj
ID: 2625721
Here's the way I do it:
Drop a regular combobox instead. Add Table component and datasource hooked to the table component.
At design time set sorted property to true.
Programmatically( you may want to add this in the Form.Create event handler):
table1.active:=false;
table1.tablename:=<tablename>;
table1.disablecontrols;
table1.open;
table1.first;
while not table1.eof do
begin
combobox1.items.add(
table1.fieldByName(<fieldname>).AsString);
table1.next
end;
table1.enablecontrols;

This will produce a sorted combo box of items.

I've messed with the dblookupcombo and like my way better.
0
 

Author Comment

by:Angela030399
ID: 2641148
Thanks The Neil,

I pad Rqst_ID values with 0's which was the easiest to do.

Thanks, Angela
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month11 days, 7 hours left to enroll

752 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