Page 1 of 1

clear IndexFieldNames for a new Open

Posted: Tue 17 Aug 2010 08:17
by easyblue
Hello

[problem]:
When combine OraQuery and CRDBGrid, I found that if for CRDBGrid, I have enabled "LocalSorting" for performance, then in following cases:

1. I click on the grid title to sort the result
2. I use the same OraQuery to open a new query, whose result contain no previous sorted field

there will be an error due to missing of the sorting field.

Checking source code, found that
OraQuery->IndexfieldNames has been changed by CRGrid, and remain the same value for the new query.

[Temp Solution]:
need a manual reset of

Code: Select all

                   OraQuery->IndexFieldNames="";
before opening a new one.

[Question]:
1. can such IndexFieldNames be automatically reset upon new query if its SQL has been changed?
2. will also "LocalFilter" of CRDBGrid, who changes OraQuery->FilterSQL also need such a verification?

Posted: Wed 18 Aug 2010 10:24
by AlexP
hello,

We can't change this behaviour, because other our users need IndexFieldNames to keep its value after reopening the query or changing its SQL text. For example:

Code: Select all

OraQuery.IndexFieldNames:= 'FIELD1';
OraQuery.SQL.Text := 'SELECT 1 AS FIELD1 FROM DUAL'; <-- if IndexFieldNames are reset, as you want, users will not get the expected behaviour
OraQuery.Open;
If you changed this property and then changed query text, it is necessary to reset this property manually.

You can reset needed attributes in the AfterClose Event.

Posted: Thu 19 Aug 2010 00:36
by easyblue
Hello

Or maybe an enhancement of documentation of TCRDBGrid for its filtering and sorting features, so user can easily found out this manual solution?

Posted: Thu 19 Aug 2010 07:46
by AlexP
Hello,

Thanks, we will add this information to our documentation.