Page 1 of 1
Save current position in UniTable
Posted: Sat 07 Jun 2014 19:57
by testpresta
Hello
I want to call Locate method on a TUniTable component in order to search a particular record.
Then i want to go back to the previous record.
How should i do ?
There is no « current position » property on TUniTable. I saw an « active record » property in source code but this property is not accessible.
I am working on Delphi
Thanks for your answer
Re: Save current position in UniTable
Posted: Sun 08 Jun 2014 18:23
by testpresta
Just a remark. I noticed there is a recno property but this property is not correct when the UniTable is sorted.
The numbers are re-affected...
Thanks
Re: Save current position in UniTable
Posted: Tue 10 Jun 2014 08:47
by CristianP
Hello,
You can use GetBookmark, GotoBookmark, and FreeBookmark.
Best Regards,
Cristian Peta
Re: Save current position in UniTable
Posted: Tue 10 Jun 2014 09:04
by AlexP
Hello,
For this, you can save the value of the key field for the current record, and after all operations return to the required record using the Locate method:
Code: Select all
var
empno: integer;
begin
UniTable1.SQL.Text := 'SELECT * FROM EMP';
UniTable1.OrderFields := 'ENAME ASC';
UniTable1.KeyFields := 'EMPNO';
UniTable1.Open;
empno := UniTable1.FieldByName('empno').AsInteger;
UniTable1.LocateEx('EMPNO', 7788, []);
UniTable1.OrderFields := 'ENAME DESC';
UniTable1.LocateEx('empno', empno, []);
end;
Re: Save current position in UniTable
Posted: Tue 10 Jun 2014 18:27
by testpresta
Thanks for your answers.
Bookmarks are the same than Recno. If i order by the table it gives a mistake...
Working with primary key is a good idea but i want to do something generic for several UniTables objects.
Thanks
Re: Save current position in UniTable
Posted: Wed 11 Jun 2014 08:29
by AlexP
We plan to improve work with Bookmark, in order to avoid such situations. However, we cannot tell the exact terms of implementation of this feature.