I have a column in a DB table which stores pressure. The pressure is always stored as PSI and can be converted to BAR by diving by 14.5.
The user can toggle display of PSI/BAR with a Radio Group.
I was using a TStringGrid
and am converting to a TDbGrid
- which is quite new to me.
When the user toggles PSI/BAR, how to I update the display in my DB grid? (I imagine that I just execute it's query again? or Call query.Refresh()
?) But how do I do the conversion?
- Possibly a stored procedure, although that seems like overkill and stored procedurs are also new to me...
- By changing the
SELECT
statement of my query? But how would I do that?SELECT pressure / 14.5 FROM measurements
? Or how? - Or is there an
OnBeforeXXX()
which I can code? OrOnGetDisplayText()
or some such?
I am sure thta this is very basic, but until now I have just been displaying unmanipulated data and now I need a conversion function. Google didn'ty help, but I probably didn't know what to ask for.
I also want to change the text of the column title, toggling between "Presure (PSI)" and "pressure (BAR)". Thanks in advance for any help.