Solved

how to sort rows in grid using lookup field column?

Posted on 2001-06-11
7
341 Views
Last Modified: 2007-12-19
Hi,

Is there anyway to sort rows in grid using column that is based on lookup field?

The grid contains one lookup field that is pointing to the master file record ( i.e. EmployeeName ), I need to sort the rows based on the Employee's Name.  How?

Thanks
0
Comment
Question by:llkhor
7 Comments
 
LVL 22

Accepted Solution

by:
Mohammed Nasman earned 50 total points
ID: 6176242
Hello

  If you want to sort ur data in ur grid, you need to do that in the dataset (table or query), for table, make an index in the field that u want to sort on, then from table property
IndexFieldName = anyindexfield u make

or u can use the query and order by to sort any field u like, in the query component sql text:
'select * from customer oder by company' if you want to sort ur data using the company field

also you can download some dbgrid from torry that could sort ur data
http://www.torry.net/db_grids.htm

Best regards
Mohammed Nasman
0
 

Author Comment

by:llkhor
ID: 6176586
mnasman :  I know both the methods you described, i am just curious if u could do sorting with lookup field (kind=fkLookup) instead.  

Thanks.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6176991
only with a query by including the field, which is referenced like

select a.*, b.lookupresultfield from tableA a, tableB b where a.lookupidfield = b.idfield order by b.lookupresultfield

in some databases b.fields must not be included into the fieldlist after the select in some other databases is this a must

meikl ;-)
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:llkhor
ID: 6179607
Thanks for the feedbacks....  
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 8451579
Upon review of the comments here, I am recommending this disposition:

        points to mnasman

Please post a comment if you disagree.

DanRollins -- EE database cleanup volunteer
0
 

Expert Comment

by:SpideyMod
ID: 8492512
per recommendation.

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
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…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

929 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now