1) How can I sort the columns in a descending order ?
2) I can't create the sorted columns for AutoDBGrid.
3) I can't make AutoDBGrid to work with AutoQuery.
4) My DBGridDateBtn doesn't work.
II. Visual Filter Components
1) My filter of the AutoTable doesn't work.
2) I don't want to change my macros at design time.
III. DBReference
1) How can I add controls to the bottom of the DBReference pop-up form ?
2) I can't understand how to display a reference Text.
I. AutoDBGrid
1)
Q.
How can I sort the columns in a descending order ?
A.
If you use AutoQuery it is not a problem but as I understand you use the Table as DataSet for AutoDBGrid and you have an ascendant index for this field. In this case you have to add an index file for the field that has to be sorted in a descending order and AutoDBGrid is smart enough to allow the user to sort it both in an ascending and in a descending order
P.S.: Use AutoQuery and you will not have the problem and you will be able to sort any field in the way you want.
2)
Q.
I can't create the sorted columns for AutoDBGrid. I use AutoDBGrid and AutoQuery.
A.
You have to create the DBGrid columns or Query Field at design time. To create the sorted column just press the Ctrl key and click the left mouse button.
Why do you have to do it?
Because we need to save the information about the sorted columns. We save it in the following cases:
If the first character of the column label is '+' then the sorting order is ascendant;
if it is '-' then it is descendent, otherwise it is not sorted.
You also can create it at runtime (see the help file: Basic Features -> Sorted TAutoDBComponent for more information)
3)
Q.
I can't make work the AutoDBGrid to work with AutoQuery. It always appears the error: 'Invalid use keyword. Token BY'. I do the following:
Add the macro '&Orderby' to AutoQuery, drop FilterLink and link the AutoDBGrid with the macro of the AutoQuery. What is happening? Is it a bug ?
A.
You forgot to assign the TextBefore property of the AutoFilter of the AutoDBGrid: AutoDBGrid.AutoFilter.TextBefore := 'Order by ' (do not forget to add the space to the end of the string). It works in this case:
Where AutoDBGrid.AutoFilter.Text = AutoDBGrid.AutoFilter.TextBefore + AutoDBGrid.AutoFilter.Value + AutoDBGrid.AutoFilter.TextAfter, where AutoDBGrid.AutoFilter.TextBefore = 'Order by ' and AutoDBGrid.AutoFilter.Value = '<sortedfieldname> [DESC]'.
Of course the FilterLink is smart enough to do it itself with no additional code.
4)
Q.
My DBGridDateBtn doesn't work.
A.
You have to create the DBGridColumn at design time and your DBGridDateBtn will be working perfectly.
II. Auto Visual Filter Library
1)
Q.
My filter of the AutoTable doesn't work.
A.
The typical error is when you try to compare a macro to a constant. The macro is a constant and BDE does not allow to compare constants in a BDE filter. Do not try to create a complex expression in the Filter property.
Use the Params in Query (AutoQuery) and your filters will be working perfectly.
2)
Q.
I don't want to change my macros at design time. Can I do something about it ?
A.
Yes, it is very simple. Set the MacrosFreeze to nfDesigning.
III. DBReference
1)
Q.
How can I add controls to the bottom of the DBReference pop-up form?
A.
For this purpose we have created the TReferencePanel. You can place any Delphi controls (which is especially useful to place the Visual Filter Control) on it and then assign it to the ReferencePanel property of the DBReference. Use the component Editor 'Change Style' of the ReferencePanel and you will understand how to add the controls to the pop-up form at design time.
2)
Q.
I can't understand how to display a reference Text.
A.
First set the property VisibleText to True (You also can use the 'Change Visible Text' component editor). Then Set the PatternText (use the property Editor). For more information see the help on the PatternText property.