PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN

  • Example for managing the positions in a data file
  • Reinitializing positions
  • Various
  • 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/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
<Source>.SavePosition (Function)
In french: <Source>.SauvePosition
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 <Source>.RetourPosition. Then, the main process can continue.
<Source>.SavePosition 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 <Source>.RetourPosition to restore the stored filter.
This function can be used with the data files, HFSQL views or queries. Remark: From version 19, HFSQL is the new name of HyperFileSQL.
Example
// Find a record
Customer.ReadSeekFirst(Name, Name)
WHILE Customer.Found() = True
// Saves the current context
nPos = Customer.SavePosition(Name)
// Check a customer with another name
Customer.ReadSeek(Name, Name2)
IF Customer.Found() = True THEN Counter = Counter + 1
// Restores the context
HRestorePosition(nPos)
Customer.ReadNext(Name)
END
Syntax
<Result> = <Source>.SavePosition([<Item>] [, <Options>])
<Result>: Integer
  • Number of the position that was saved,
  • -1 if an error occurred.
<Source>: Type corresponding to the specified source
Name of data file, view or query used. If this name is not specified, <Source>.SavePosition will use the last data file used by the last HFSQL management function (function starting with "H").
<Item>: Optional character string (with or without quotes)
Name of item used. If this parameter is not specified, <Source>.SavePosition saves the positions of all items for which a browse is in progress.
Hyper File 5.5 The <Item> parameter will be ignored: the position will be stored for all items on which a browse is in progress.
<Options>: Optional integer constant
Used to configure the backup:
hSaveItemsSaves the values of items in memory when using <Source>.SavePosition. These values will be restored during the call to <Source>.RetourPosition.
Remarks

Example for managing the positions in a data file

<Source>.SavePosition and <Source>.RetourPosition can be used in the following cases for example:
  • form used to display a record and to browse the data file according to a key. Another window is called to display the data as a table. The management of the positions makes it possible to simply return to the correct Record in the course of the files.
  • viewing a data file in a Table control. When selected, the record is displayed as a form, with the possibility of browsing 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 (<Source>.Creation, <Source>.Close, etc.).

Various

  • The number of calls to <Source>.SavePosition is not limited.
  • You have the ability to nest <Source>.SavePosition and <Source>.RetourPosition for the same data file.
  • If the record pointed during the call to <Source>.SavePosition is deleted, <Source>.RetourPosition cannot be called anymore.
OLE DBNative Connectors (Native Accesses)

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

If the database or the status of browse (re-initialized browse for example) does not allow you to directly reposition on the record, the positioning is performed in the cache of records read.
The following functions reinitialize the browse:
This operating mode is the same in Java.
Business / UI classification : Business Logic
Component : wd260hf.dll
Minimum version required
  • Version 25
This page is also available for…
Comments
Click [Add] to post a comment