Grid Lookup too slow

Hello,

The records in my grid are indexed by an id. Each id also corresponds to one unique date (German format: dd.mm.yyyy).
So, primary key can be either the id or the date.

I group by this id/date, to show charts with the date on the X-axis.
Now I want to sort by this date.
If I sort by date, then it is sorted
01.01.2010,
05.01.2009,
07.01.2010 an so on.
Which is not correct, but obviously results from my date format.

So I try to group by and sort by the id.
Thats working fine.
I use “grid lookup” to show the corresponding date and not the id, which is of no interest for the user.
But that slows down dramatically, with growing number of records, since for each record a separe lookup is done:

SELECT date FROM <table> WHERE date_id = {table.date_id} ORDER BY date
  • Is it possible to simply replace the id by the corresponding date? Anyway, I select this date in the initial SQL and there a quick JOIN is done, which is far more efficient than hundreds of seperate lookups?

  • Or: is it possible to group by date (in German format: dd.mm.yyyy) but sorting correctly by yyyymmdd?

Thanks for your help!