Page 1 of 1
Forum

Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!

Topics for particular software or systems: Start your topic link with the name of the application or system.
For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.

Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is no translation for that post!



How to replace the ...
 
Share:
Notifications
Clear all

How to replace the field type and value in dbgrid?

2 Posts
2 Users
0 Likes
2,247 Views
(@adamlevine)
New Member
Joined: 4 years ago
Posts: 1
Topic starter  

How to replace the field type and value in dbgrid?

My SQL query:

Code: XML [Select] DBForm.DBquery.SQL.text:='select callstart, callend, origin, destination, direction from callrecord;

termtype are integer values 0...3, instead I would like to show in dbgrid column fields: None, Incoming, Outgoing or Internal, accordingly. These text values are not stored in any DB table to be joined with; it is also not allowed to add smth to this DB (in my case). Is there a way how to do this "on fly", when the dbgrid obtains the values from the DB?


ReplyQuote
 Hans
(@hans)
Noble Member Admin
Joined: 9 years ago
Posts: 2234
 

I do not have my gear near me at the moment, but as far as I recall, you can define in the TSQLQuery (for example) the data return values in one fo the events. I think it's under "OnCalcFields". It may also have been "OnDrawColumnCell" of TDBGrid.

In Delphi, the TDBGrid has a OnGetText event - which I used to do exactly what you're doing.
A quick look at Lazarus I could not find this event (doing a quick search).

When looking in the Lazarus forum I found this post that might help: link. I assume you already looked at this link as well ...

Hope this is helpful.


ReplyQuote
Share: