![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 1 to 8 of 8 total |
![]() |
Tue, Dec 7 2010 10:11 PM | Permanent Link |
Chris B | Hi,
I'm working with a filtered dataset in EDB 2.04B4 and have come across an issue where (at first) Locate appeared to fail for no apparent reason. Some simplified code below: ds->Filtered = true; ds->OnFilterRecord = MyOnFilterRecord; void __fastcall TMyForm::MyOnFilterRecord(TDataSet *DataSet, bool &Accept) { Accept = DataSet->FieldByName("Type")->AsInteger != 16; } This is the recordset ProductCode Type 320802 8 320802 8 320802 16 293709 8 Calling ds->Locate("ProductCode", 320802) returns False each time in this case. If filter is removed, Locate works again. I figured out that Locate happens to find the third record (with Type = 16) and filters it out. It then moves to the next record (with ProductCode = 293709), which does not match the original criteria, so it returns False. Is there any workaround for this? Instead of moving to the next record after OnFilterRecord rejects the current record, could Elevate try to recursively call Locate again, this time excluding the record that was filtered out in the first round? |
Wed, Dec 8 2010 4:21 AM | Permanent Link |
Roy Lambert NLH Associates ![]() | Chris
I'm a Delphi user so maybe there's a good reason for your using the OnFilter event. If not and your filter condition is as simple as it seems why not just try a simple filter eg in Delphi table.Filter := 'Type <> 16'; table.Filtered := True; Roy Lambert [Team Elevate] |
Wed, Dec 8 2010 3:22 PM | Permanent Link |
Chris B | Roy Lambert wrote:
<< I'm a Delphi user so maybe there's a good reason for your using the OnFilter event. If not and your filter condition is as simple as it seems why not just try a simple filter eg in Delphi table.Filter := 'Type <> 16'; table.Filtered := True; > > Hi Roy, The example I've given is very simplistic and only there to demonstrate the problem. Our production code is much more complex. A Filter is actually used for some of the simple conditions. OnFilter event is used on top of the Filter. Cheers, Chris |
Thu, Dec 9 2010 3:45 AM | Permanent Link |
Roy Lambert NLH Associates ![]() | Chris
>The example I've given is very simplistic and only there to demonstrate the problem. Our production code is much more complex. A Filter is actually used for some of the simple conditions. OnFilter event is used on top of the Filter. In that case what about moving from a table to a query? It might mean an insensitive result set which could be a problem. Roy Lambert [Team Elevate] |
Thu, Dec 9 2010 3:48 AM | Permanent Link |
Mauro Botta | Is a official bug ?
I'm using 2.03 Build 14 but... i'm working now for move to Delphi XE and EDB 2.4 Build 4 if there is this bug i'm wait .. Build 5 ^^ |
Thu, Dec 9 2010 4:04 PM | Permanent Link |
Chris B | Roy Lambert wrote:
In that case what about moving from a table to a query? It might mean an insensitive result set which could be a problem. Roy, I'm not sure what you're getting at. The resultset is already insensitive in this case. How would the change fix problems with Locate? |
Fri, Dec 10 2010 7:53 AM | Permanent Link |
Roy Lambert NLH Associates ![]() | Chris
>In that case what about moving from a table to a query? It might mean an insensitive result set which could be a problem. >I'm not sure what you're getting at. The resultset is already insensitive in this case. >How would the change fix problems with Locate? I was assuming you were using a table not a query. I'm now guessing that since the resultset is insensitive that you're using a query. In which case, since you're already working with an insensitive query can you not build the filter and onfilter stuff into the sql producing the resultset? Locate should then work as expected. Roy Lambert [Team Elevate] |
Fri, Dec 10 2010 2:16 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Chris,
<< Is there any workaround for this? >> The issue is caused by doing a Locate on a non-indexed column. The only workaround is to make sure that the column that you're searching on is indexed. A fix will be in the next release. -- Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Wednesday, August 14, 2024 at 07:31 PM | Privacy Policy![]() © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |