|
|
|
|
|
|
|
|
|
|
- Example for managing the positions in a table
- Reinitializing positions
- Miscellaneous
- Repositioning by OLE DB and Native MySQL, DB2 and Informix Connectors
HSavePosition (Function) In french: HSauvePosition
Not available with this kind of connection
Stores the current context of a table: current record, filter, read pointers. This allows you to temporarily suspend the current process in order for the table to be used somewhere else (to perform checks for example). The saved context can be restored by HRestorePosition. Then, the main process can continue. HSavePosition is used to save: - the number of the record used,
- the different pointers in the index (the position in the index is saved for each key),
- the current filter. You will have to use the hRPFilter constant in HRestorePosition to restore the stored filter.
This function can be used with the tables, HFSQL views, or queries.
HReadSeekFirst(Customer, Name, Name)
WHILE HFound(Customer) = True
nPos = HSavePosition(Customer, Name)
HReadSeek(Customer, Name, Name2)
IF HFound() = True THEN Counter = Counter + 1
HRestorePosition(nPos)
HReadNext(Customer, Name)
END
Syntax
<Result> = HSavePosition([<Table> [, <Item>]] [, <Options>])
<Result>: Integer - Number of the position that was saved,
- -1 if an error occurred.
<Table>: Optional character string Name of the table, view or query used. If this name is not specified, HSavePosition will use the last table used by the last HFSQL function (function starting with "H"). <Item>: Optional character string Name of the item used. If this parameter is not specified, HSavePosition saves the positions of all items being looped through.
<Options>: Optional integer constant Used to configure the backup:
| | | | hSaveItems | Saves the values of items in memory when using HSavePosition. These values will be restored next time HRestorePosition is called. | |
Remarks Example for managing the positions in a table HSavePosition and HRestorePosition can be used in the following cases for example: - form used to display a record and to loop through the table according to a key. Another window is called to display the data as a table. Positions allow you to easily go back to desired record in the iteration.
- viewing a table in a Table control. When selected, the record is displayed as a form, with the possibility of looping through forms. The position management allows you to display the Table control again while being properly positioned on the table.
Reinitializing positions Please note: all functions which open or close a table reset the context numbers (e.g. HCreation, HClose, ...). Miscellaneous - The number of calls to HSavePosition is not limited.
- You have the ability to nest HSavePosition and HRestorePosition for the same table.
- If the record pointed during the call to HSavePosition is deleted, HRestorePosition cannot be called anymore.
Business / UI classification: Business Logic
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|