SortHelper combined columns

Hi, I'd like to sort table of patiens with lastname, firstname in the same column. Of course in the model Patient there are two columns, which I need joined while sortable. Is there any way to do that with SortHelper?

Regards, Zdravko

Can you be more explicit in what you want to sort on? Do you want to sort by lastname and then within those with the same lastname then sort by firstname? If so then just specify something like @patients.order(:lastname, :firstname)

Colin

I use SortHelper which provides for sorting by any column of the table. With patient name I would like to have only one column. The combined column could be 'name' as in: select ..., lastname||', '||firstname as name from patients... order by name

This column does not appear in the table itself. It is concatenated column. Ordering by name would also provide for correct ordering. Can I fool SortHelper to use such a fake column (not in the model) to work with?

I use SortHelper which provides for sorting by any column of the table. With patient name I would like to have only one column. The combined column could be 'name' as in: select ..., lastname||', '||firstname as name from patients... order by name

This column does not appear in the table itself. It is concatenated column. Ordering by name would also provide for correct ordering. Can I fool SortHelper to use such a fake column (not in the model) to work with?

No idea as I don't know what SortHelper is, and a quick google revealed nothing that looked in any way current. Why would you not want to do this the most efficient way which is likely to be when fetching from the database?

Note that if you just concatenate the columns you will be unlikely to get what you want, as you need it to sort on lastname then firstname, which may not be the case if you just concatenate the strings.

Colin