![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 1 to 7 of 7 total |
![]() |
Mon, Oct 31 2011 6:41 PM | Permanent Link |
IQA | Hi,
I'm not sure if this is an ElevateDB problem or not. But I have some code that locates the record that's been added using: TLocateOptions Options; Options.Clear(); EventQuery->Locate("res_num", APlannerItem->DBKey, Options); It works perfectly when there are already existing records in the table. But when it's the first one, it doesn't locate the record. I can get around it by checking the RecordCount, but wonder if this is normal? Thanks ![]() |
Tue, Nov 1 2011 1:34 PM | Permanent Link |
Adam Brett Orixa Systems | EventQuery->Locate("res_num", APlannerItem->DBKey, Options); I don't use Locate much, but I am pretty sure that it only returns a positive result if the process involves moving through the database. If you are already at the result (which you are in the case you describe) then it doesn't report a positive result. You might want to test whether the current record is the correct record first ... if that is true, return a positive result, if not then run the Locate. Adam |
Wed, Nov 2 2011 3:11 PM | Permanent Link |
Fernando Dias ![]() | Philip,
I can't reproduce that behavior here. What version are you using? Also, can you give us more details about what you are doing? What type is the column you are using to locate and what's the value of DBKey when it failed? When you say it doesn't locate the row you added, do you mean its been added just before the locate? Are you sure you posted the row to the database before Locate? -- Fernando Dias [Team Elevate] |
Thu, Nov 3 2011 8:04 PM | Permanent Link |
IQA | Hi Fernando,
It's a strange one, cause it only happens when it's the very first record in the empty 'event' table and once records already exist, it's all perfect. DBKey is a UnicodeString. I have code inserting the record and it works perfectly. I actually worked around it by checking the RecordCount as follows: // Locate only works if more than 1 record if (DM->EventQuery->RecordCount > 0) { // goto record of the new item just inserted. TLocateOptions Options; Options.Clear(); DM->EventQuery->Locate("res_num", APlannerItem->DBKey, Options); } else DM->EventQuery->First(); |
Thu, Nov 3 2011 8:06 PM | Permanent Link |
IQA | Sorry in addition I'm using V2.60 Build 1
|
Thu, Nov 3 2011 10:57 PM | Permanent Link |
Fernando Dias ![]() | Philip,
I just reproduced that here with 2.05.11 and 2.05.10. It only happens when the new row is being added through another dataset, and in that case DM->EventQuery doesn't 'see' the recently added row, until you refresh it. As a workaround, just refresh before locating: DM->EventQuery->Refresh. I'll ask Tim about it, but it looks like a bug. -- Fernando Dias [Team Elevate] |
Fri, Nov 4 2011 6:27 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Fernando,
<< I just reproduced that here with 2.05.11 and 2.05.10. >> Yes, it's a bug. It only occurs with Locate on an empty table, and only when the Locate uses an index. -- 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 ? ![]() |