PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN

  • Example for managing the positions in a data file
  • Reinitializing positions
  • Miscellaneous
  • Repositioning by OLE DB and Native MySQL, DB2 and Informix Connectors
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
HSavePosition (Function)
In french: HSauvePosition
ODBCNot available with this kind of connection
Stores the current context of a data file: current record, filter, pointers. This allows you to temporarily suspend the current process in order for the data file 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 data files, HFSQL views or queries.
Versions 15 and later
Android This function is now available for Android applications.
New in version 15
Android This function is now available for Android applications.
Android This function is now available for Android applications.
Versions 17 and later
iPhone/iPad This function is now available for iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for iPhone/iPad applications.
iPhone/iPad This function is now available for iPhone/iPad applications.
Versions 18 and later
Android Widget This function is now available in Android widget mode.
New in version 18
Android Widget This function is now available in Android widget mode.
Android Widget This function is now available in Android widget mode.
Remark: From version 19, HFSQL is the new name of HyperFileSQL.
Versions 21 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Example
// Find a record
HReadSeekFirst(Customer, Name, Name)
WHILE HFound(Customer) = True
// Saves the current context
nPos = HSavePosition(Customer, Name)
// Check a customer with another name
HReadSeek(Customer, Name, Name2)
IF HFound() = True THEN Counter = Counter + 1
// Restores the context
HRestorePosition(nPos)
HReadNext(Customer, Name)
END
Syntax
<Result> = HSavePosition([<Data file> [, <Item>]] [, <Options>])
<Result>: Integer
  • Number of the position that was saved,
  • -1 if an error occurred.
<Data file>: Optional character string
Name of the data file, view or query used. If this name is not specified, HSavePosition will use the last data file 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.
Hyper File 5.5 The <Item> parameter will be ignored: the position will be saved for all items being looped through.
<Options>: Optional integer constant
Used to configure the backup:
hSaveItemsSaves the values of items in memory when using HSavePosition. These values will be restored next time HRestorePosition is called.
Versions 24 and later
AndroidAndroid Widget Java This constant is only available for HFSQL data files.
New in version 24
AndroidAndroid Widget Java This constant is only available for HFSQL data files.
AndroidAndroid Widget Java This constant is only available for HFSQL data files.

AndroidAndroid Widget Java This parameter is not supported.
Remarks

Example for managing the positions in a data file

HSavePosition and HRestorePosition can be used in the following cases for example:
  • form used to display a record and to loop through the data file 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 data file 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 data file.

Reinitializing positions

Caution: all the functions that open or close a data file reinitialize the context numbers (HCreation, HClose, etc.).

Miscellaneous

  • The number of calls to HSavePosition is not limited.
  • You have the ability to nest HSavePosition and HRestorePosition for the same data file.
  • If the record pointed during the call to HSavePosition is deleted, HRestorePosition cannot be called anymore.
WINDEVWEBDEV - Server codeJavaPHPOLE DBNative Connectors (Native Accesses)

Repositioning by OLE DB and Native MySQL, DB2 and Informix Connectors

If the database or the status of the iteration (e.g., reinitialized) does not allow resetting the position directly on the record, the position is set using the cache of records read.
The following functions reinitialize the iteration:
This operating mode is the same in Java.
Business / UI classification: Business Logic
Component: wd270hf.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment