[bug_fixed] Do not work sorterfields
Moderators: EgonHugeist, mdaems
[bug_fixed] Do not work sorterfields
In previor 6.5 version sorting in dataset (class TZAbstractRODataset) work absolutately correct.
In version 6.6 bangfauzan modifation have broken sorting.
Where sort asc or desc in 1 field, method do not work.
Example
Sord ID asc, Name desc this method do not work correct.
method InternalSort
if FIndexFieldNames = '' then exit; {bangfauzan addition}
Why if dataset do not have index - do not sort?
Please rework this methods.
In version 6.6 bangfauzan modifation have broken sorting.
Where sort asc or desc in 1 field, method do not work.
Example
Sord ID asc, Name desc this method do not work correct.
method InternalSort
if FIndexFieldNames = '' then exit; {bangfauzan addition}
Why if dataset do not have index - do not sort?
Please rework this methods.
-
- Senior Boarder
- Posts: 50
- Joined: 31.08.2006, 10:41
- Contact:
Currently, sorting two or more fields with different sort method (asc on one field and desc on the others) doesnt work. becouse order method handled by SortType property which we can sort asc only or desc only over all of fields defined in SortedFields.
obviously, it is a bug. and I will try to rework it.
for this moment, you can use sql script.
regards.
obviously, it is a bug. and I will try to rework it.
for this moment, you can use sql script.
regards.
-
- Senior Boarder
- Posts: 50
- Joined: 31.08.2006, 10:41
- Contact:
Bug-Fix for SortedFields, SortType and IndexFieldNames
Before this revision, SortType has only 2 values (stAscending and stDescending). So, consistent with that, all field on the SortedFields can be sorted ascending only or descending only.
Now, I add new value into SortType named stIgnored, means that SortType being Ignored and we can sort each field iether ascending or descending separately.
So, we can type : "ID Asc;Name Desc" on the SortedFields or IndexFieldNames, and i works properly with correct results.
The revision attached below.
Regards.
Now, I add new value into SortType named stIgnored, means that SortType being Ignored and we can sort each field iether ascending or descending separately.
So, we can type : "ID Asc;Name Desc" on the SortedFields or IndexFieldNames, and i works properly with correct results.
The revision attached below.
Regards.
You do not have the required permissions to view the files attached to this post.
-
- Senior Boarder
- Posts: 50
- Joined: 31.08.2006, 10:41
- Contact:
Re: [bug_report] Do not work sorterfields
Correction :Visor123 wrote:
method InternalSort
if FIndexFieldNames = '' then exit; {bangfauzan addition}
Why if dataset do not have index - do not sort?
In the current version 6.6.0 beta, IndexFieldNames does not relate to the Index, but for sorting only. Becouse the old IndexFieldNames (as you mean) was replaced by LinkedFields.
Regards.
Check my post http://zeos.firmos.at/viewtopic.php?t=898.
bangfauzan, Your new solution doesn't work with many fields.
Firstly.
In SetSortedFields You first get sort type, than You cut text after first space.
It doesn't occure when there are simultaneously ASC and DESC in Value or
if there are not ASC and DESC and previous value of FSortType was stIgnored (by default is stAscending).
If you have to remove ASC and DESC from Value,
instead of:
try this:
After patch over, You can check below:
Secondly.
Try to set SortFields with this:
OP_DATE DESC,OP_NR,OP_RECORD DESC
GetSortType returns stDescending!!! Why???
OP_NR is ascending by default!!!
You must use other method to determine sort type.
You must check each column in text separately.
Thirdly.
GetIndexFieldNames returns wrong value. For example:
SortedFields:='OP_DATE DESC,OP_NR DESC,OP_RECORD DESC';
GetSortType returns stDescending - correct, but
GetIndexFieldNames returns 'OP_DATE,OP_NR,OP_RECORD Desc' - INCORRECT!!! Only the third column is sorted descending, first two
column are sorted ascending.
You must set sort type of each column separately.
Please rework this methods.
Regards.
bangfauzan, Your new solution doesn't work with many fields.
Firstly.
In SetSortedFields You first get sort type, than You cut text after first space.
It doesn't occure when there are simultaneously ASC and DESC in Value or
if there are not ASC and DESC and previous value of FSortType was stIgnored (by default is stAscending).
If you have to remove ASC and DESC from Value,
instead of:
Code: Select all
if (FSortType <> stIgnored) and (Pos(' ',Value)>0) then
Value:=Copy(Value,1,Pos(' ',Value)-1); {bangfauzan addition}
Code: Select all
if (FSortType <> stIgnored) and (Pos(' ',Value)>0) then
begin
while Pos(' DESC',UpperCase(Value))>0 do
Value:=Copy(Value,1,Pos(' DESC',UpperCase(Value)))+
Copy(Value,Pos(' DESC',UpperCase(Value))+6,Length(Value));
while Pos(' ASC',UpperCase(Value))>0 do
Value:=Copy(Value,1,Pos(' ASC',UpperCase(Value)))+
Copy(Value,Pos(' ASC',UpperCase(Value))+5,Length(Value));
end;
Secondly.
Try to set SortFields with this:
OP_DATE DESC,OP_NR,OP_RECORD DESC
GetSortType returns stDescending!!! Why???
OP_NR is ascending by default!!!
You must use other method to determine sort type.
You must check each column in text separately.
Thirdly.
GetIndexFieldNames returns wrong value. For example:
SortedFields:='OP_DATE DESC,OP_NR DESC,OP_RECORD DESC';
GetSortType returns stDescending - correct, but
GetIndexFieldNames returns 'OP_DATE,OP_NR,OP_RECORD Desc' - INCORRECT!!! Only the third column is sorted descending, first two
column are sorted ascending.
You must set sort type of each column separately.
Please rework this methods.
Regards.
-
- Senior Boarder
- Posts: 50
- Joined: 31.08.2006, 10:41
- Contact:
Problem Solved
Hi pawelsel,
All problem so far was revised and completely solved.
Revision only made in GetSortType procedure.
Previously :
and discuss to find solution.
Please install and test this patch,
I'm waiting for your comments.
The attachment below.
Regards.
All problem so far was revised and completely solved.
Revision only made in GetSortType procedure.
Previously :
Revision :if (Pos(' ASC',UpperCase(FIndexFieldNames))>0) and
(Pos(' DESC',UpperCase(FIndexFieldNames))>0) then
Result:=stIgnored
else if Pos(' ASC',UpperCase(FIndexFieldNames))>0 then
Result:=stAscending
else if Pos(' DESC',UpperCase(FIndexFieldNames))>0 then
Result:=stDescending
else
Result:=FSortType;
In the future, if some problem found, we can shareif (Pos(',',FIndexFieldNames)>0) or (Pos(';',FIndexFieldNames)>0) then
Result:=stIgnored
else if Pos(' DESC',UpperCase(FIndexFieldNames))>0 then
Result:=stDescending
else
Result:=stAscending;
and discuss to find solution.
Please install and test this patch,
I'm waiting for your comments.
The attachment below.
Regards.
You do not have the required permissions to view the files attached to this post.
Re: Problem Solved
What about deleting the "SortType" property coz for me it cause more sorting problem, just put the "SortedFields" property and the documentation of the ZeosDBO add the information about how to sort it ascending or descending and how to sort multiple fields.
One question again, "IndexFieldNames" behave like "SortedFields", it will confusing for the new ZeosDBO users, I think the "IndexFieldNames" property should be deleted or not published.
Or there is any reason?
One question again, "IndexFieldNames" behave like "SortedFields", it will confusing for the new ZeosDBO users, I think the "IndexFieldNames" property should be deleted or not published.
Or there is any reason?
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
Hi Visor,
I'll commit this version. That way this issue will be fixed in next release.
@pawelsel/@bangfauzan/@cipto_kh : if an other bug remains or you want to finetune this behaviour (which we really appreciate), please open a separate thread in the appropriate forum.(bugreport/user patch/general 6.6/...)
Mark
I'll commit this version. That way this issue will be fixed in next release.
@pawelsel/@bangfauzan/@cipto_kh : if an other bug remains or you want to finetune this behaviour (which we really appreciate), please open a separate thread in the appropriate forum.(bugreport/user patch/general 6.6/...)
Mark