Recent

Author Topic: DBGrid - sorting by LookUp or calculated column  (Read 1606 times)

tsr

  • New Member
  • *
  • Posts: 21
DBGrid - sorting by LookUp or calculated column
« on: February 04, 2016, 02:14:17 pm »
1. How to sort data in DBGrid by lookup column or calculated column?

I have a code to sort a column by clicking on its title. Works fine for normal fields but not for lookup. Error message:
List index (-2) out of bounds.

I have used the code from wiki:
http://wiki.freepascal.org/How_to_write_in-memory_database_applications_in_Lazarus/FPC#Sorting_DBGrid_on_TitleClick_event_for_TBufDataSet

2. Another problem i think related to previous.
When I add lookup field to SQLQuery then some other string field is not displaying data in DBGrid. Just empty field. When I remove lookup field then the other one displays correctly. If I add two lookup fields then two others fields don't display their data. It happens with PostgreSQL connection only.
« Last Edit: February 11, 2016, 11:16:58 pm by tsr »
Ubuntu 64bit

 

TinyPortal © 2005-2018