I would like to have my grid keep track of information with two checkboxes. There is no data in the physical table that stores this.
First Checkbox – Archive Record
Second Checkbox – Recalculate Totals before Archive.
I have a Query with joins on multiple tables displaying information in a TwwDBGrid and yields a read only result. Unfortunately the grid will allow allow me to use one column to multi-select. I need more than one. Is there a way to achieve this?
I have tried adding 2 dummy fields in the query – without success. The CheckBoxes are displayed in the grid, but they don’t change when clicked on
Eg. SELECT 0 AS CBX1, 0 AS CBX2 from TABLE1 LEFT JOIN TABLE2.
The Checkbox would be used as a record marker only to indicate Archiving and Recalculation.
You can create extra fields in your query (that are not in the database) using ‘select 0 as checkbox1’, etc. Then these fields should be accessible to the grid. You will need to configure the dataset so it is editable so that the grid can toggle their checkbox. So do the following.
- Set your Cachedupdates property of your query to true.
- Set the readonly to false for your checkbox TField in your query dataset.
- When configuring it as a checkbox in the grid (dbl-click the grid to configure the column), make your true/false values match the data type. If it is an integer, make it 1 for true and 0 for false.
I tried this and it seems to work.