Solved

DBLookupCombox (Sorting)

Posted on 2000-03-16
7
234 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 100 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

690 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