how to sort rows in grid using lookup field column?

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
llkhorAsked:
Who is Participating?
 
Mohammed NasmanConnect With a Mentor Software DeveloperCommented:
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
 
llkhorAuthor Commented:
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
 
kretzschmarCommented:
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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
llkhorAuthor Commented:
Thanks for the feedbacks....  
0
 
DanRollinsCommented:
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
 
SpideyModCommented:
per recommendation.

SpideyMod
Community Support Moderator @Experts Exchange
0
All Courses

From novice to tech pro — start learning today.