PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK

This content comes from an automatic translation.
  • Automatic management of composite keys
  • Filter and filtered browse
  • Enabling/Disabling a filter
  • Data files not in HFSQL format
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
Defines and enables an "Included between" filter on a data file, view or query. The "Included Between" filter is used to select all the records included between two values.
After its execution, the most common cases are as follows:
  • the filter cannot be created: HFilterIncludedBetween returns an empty string (""). HError returns the error identifier.
  • the filter is created: HFilterIncludedBetween returns the optimized search key that will be used to browse the data file, view or query.
Remark: From version 19, HFSQL is the new name of HyperFileSQL.
Example
MySearchKey is string
MySearchKey = HFilterIncludedBetween(Customer, LastNameFirstName, ...
"A", "B" + hMaxVal, hBoundSeparator, "C", "D" + hMaxVal)
// Select all the customers whose last name is included between A and C
// and whose first name is included between C and D
HReadFirst(Customer, MySearchKey)
WHILE NOT HOut()
Trace(Customer.CustomerName, Customer.City)
HReadNext(Customer, MySearchKey)
END
...
// Disables the filter
HDeactivateFilter(Customer)
Syntax
<Result> = HFilterIncludedBetween(<Data file> , <Key item> , <Lower bound of key component 1> [, <Lower bound of key component N> [... [, <Lower bound of key component 2>]]] , <hBoundSeparator> , <Upper bound of key component 1> [, <Upper bound of key component 2> [... [, <Lower bound of key component 2>]]])
<Result>: Character string
Browse item. Corresponds to:
  • the search key of data file if the filter is enabled.
  • an empty string ("") if the filter cannot be implemented.
<Data file>: Character string (with or without quotes)
Name of data file, view or query used.
<Key item>: Character string (with or without quotes)
Name of key item onto which the filter will be applied. This item can be a simple key (string) or a composite key.
Caution: this parameter must only contain letters, underlined characters or digits. Otherwise, the name must be enclosed in quotes.
<Lower bound of key component 1>: Type of first component of search key
Lower bound for the components (first, second, etc.) of the composite key. The records corresponding to this value will be included in the filter.
The type of this parameter must correspond to the type of key item component on which the filter is defined.
<Lower bound of key component N>: Type of second component of search key
Lower bound for the second component of the composite key. The records corresponding to this value will be included in the filter.
The type of this parameter must correspond to the type of key item component on which the filter is defined.
<Lower bound of key component 2>: Type of nth component of search key
Lower bound for the nth component of the composite key. The records corresponding to this value will be included in the filter.
The type of this parameter must correspond to the type of key item component on which the filter is defined.
<hBoundSeparator>: Integer constant
The hBoundSeparator constant is used to separate the values of lower and upper bounds for the components of the composite key.
<Upper bound of key component 1>: Type of first component of search key
Upper bound for the components (first, second, ...) of composite key. The records corresponding to this value will be included in the filter.
The type of this parameter must correspond to the type of key item component on which the filter is defined.
<Upper bound of key component 2>: Type of second component of search key
Upper bound for the second component of the composite key. The records corresponding to this value will be included in the filter.
The type of this parameter must correspond to the type of key item component on which the filter is defined.
<Lower bound of key component 2>: Type of nth component of search key
Lower bound for the nth component of the composite key. The records corresponding to this value will be included in the filter.
The type of this parameter must correspond to the type of key item component on which the filter is defined.
Remarks

Automatic management of composite keys

HFilterIncludedBetween automatically manages the filters on the simple keys and on the composite keys.
Example: Using HFilterIncludedBetween with a simple key:
ResultFilter = HFilterIncludedBetween(Customer, LastName, "A", hBoundSeparator, "B" + hMaxVal)
// Select all the customers whose last name is included between A and C
Example: Using HFilterIncludedBetween with a composite key
ResultFilter = HFilterIncludedBetween(Customer, LastNameFirstName, "A", "B" + hMaxVal, ...
hBoundSeparator, "C", "D" + hMaxVal)
// Select all the customers whose last name is included between A and C
// and whose first name is included between C and D
This code line is equivalent to:
HFilter(Customer, LastNameFirstName, ...
HBuildKeyValue(Customer, LastNameFirstName, "A", "B" + hMinVal), ...
HBuildKeyValue(Customer, LastNameFirstName, "C", "D" + hMaxVal))

Filter and filtered browse

After the call to HFilterIncludedBetween, the data file must necessarily be browsed on the item returned by HFilterIncludedBetween. The filter will be ignored if another item is used to browse the data file.
When a filter is defined and enabled on a data file (view or query), all records read correspond to the filter. If no other record corresponds to the filter during the browse:
  • HOut returns True.
  • the current record corresponds to the last record read with the filter.
For example:
On a filtered data file, after the function:the current record is:
HReadFirstthe first file record corresponding to the filter
HReadLastthe last file record corresponding to the filter
HReadNext (or HForward)the next record (or the next nth record) corresponding to the filter
HReadPrevious (or HBackward)the previous record (or the previous nth record) corresponding to the filter

Enabling/Disabling a filter

  • HDeactivateFilter is used to disable a filter.
  • The HActivateFilter function allows you to re-activate a filter.
  • The filter is deleted when the data file (query or view) is closed (HClose for example).
  • A single filter can exist at a given time on a data file (query or view). If HFilterIncludedBetween is used several times, only the last filter will be taken into account: the previous filters will be deleted. Similarly, if several filters are used (HFilter* functions), only the last filter will be taken into account.
Reports and QueriesOLE DBNative Connectors (Native Accesses)

Data files not in HFSQL format

Component : wd250hf.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment