Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

DBLookupCombox (Sorting)

Posted on 2000-03-16
7
Medium Priority
?
236 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
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.

 
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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

618 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