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
3,231 Views
(@adamlevine)
New Member
Joined: 6 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)
Famed Member Admin
Joined: 10 years ago
Posts: 2507
 

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

Like what you see and you'd like to help out? 

The best way to help is of course by assisting others with their questions here in the forum, but you can also help us out in other ways:

- Do your shopping at Amazon, it will not cost you anything extra but may generate a small commission for us,
- send a cup of coffee through PayPal ($5, $10, $20, or custom amount),
- become a Patreon,
- donate BitCoin (BTC), or BitCoinCash (BCH).

Share: