ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / Managing databases / HFSQL / HFSQL functions
  • Limitations
  • xBase
  • Number of records processed by the INSERT/UPDATE/DELETE updates
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
HNbRec (Function)
In french: HNbEnr
ODBCNot available with this kind of connection
Returns the number of records in a data file, query or HFSQL view: active records, crossed records, deleted records, etc.
Caution: HNbRec ignores the current filter.
// Active records in "Customer" data file
NbCustomerRec = HNbRec(Customer)
Syntax
<Result> = HNbRec([<Data file> [, <Options>]])
<Result>: Integer
  • Number of records found,
  • -1 if an error occurred. HError returns more details about the problem.
Native Connectors (Native Accesses) Native XML Connector: the number of records depends on the use of HActivateAutoFilter/HDeactivateAutoFilter:
  • If the filtering is enabled, only the records belonging to the current parent are taken into account.
  • If the filter is not active, the records found in the XML file are taken into account.
The filtering is enabled by default.
<Data file>: Optional character string
Name of data file, HFSQL view or query used. If this parameter is not specified, HNbRec will use the last data file used by the last HFSQL management function (function starting with "H").
<Options>: Optional constant (or combination of constants)
Configures the type of record to count.
hBrowsableNonBlockingNumber of records in the view or query that can currently be read (no record locking).
This constant is available for the views and queries in HFSQL Classic or Client/Server.
This constant has no effect for the data files and for the Native Connectors
hNonBlockingNumber of records retrieved in the view or query without waiting for the view or query to be entirely filled. To knwo if the execution of the view or query is completed, use the ExecutionCompleted property.
This constant is available for the views and queries in HFSQL Classic or Client/Server.
This constant has no effect for the data files and for the Native Connectors
hStateActive
(default value)
Number of active records (not crossed or deleted).
hStateAllTotal number of records in the data file (hStateActive + hStateCrossed + hStateDel).
hStateCrossedNumber of crossed records.
Hyper File 5.5 This option is not available.
hStateDelNumber of deleted records (does not include the crossed records).

PHPOLE DBNative Connectors (Native Accesses) This parameter is ignored. The number of records calculated by HNbRec always corresponds to the total number of records in the table, in the database.
This number can differ from the number of displayed records if records have been added or deleted by another user. To view these new records, reinitialize an iteration by using one of the following functions: HReadFirst, HReadLast, HFirst, HLast.
Java Access by JDBC
This parameter is ignored. The number of records calculated by HNbRec always corresponds to the total number of records in the table, in the database.
This number can differ from the number of displayed records if records have been added or deleted by another user. To view these new records, reinitialize an iteration by using one of the following functions: HReadFirst, HReadLast, HFirst, HLast.
Remarks

Limitations

  • HNbRec does not return the number of records modified by an UPDATE query.
  • HNbRec does not work with queries that use the hWithFilter constant.
WINDEVWEBDEV - Server codeExternal languageNative Connectors (Native Accesses)

xBase

HNbRec with the hStateActive or hStateAll constant also returns the number of crossed or deleted records (backward compatibility).
However, you can get the number of crossed or deleted records by using HNbRec with the hStateDel or hStateCrossed constant.

Number of records processed by the INSERT/UPDATE/DELETE updates

When running an INSERT/UPDATE/DELETE query on HFSQL data files, the number of added, modified or deleted records is returned by the H.NbRecModificationQuery variable.
Business / UI classification: Business Logic
Component: wd300hf.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Video HnbRec
https://youtu.be/-ourTyXfwqY
https://windevdesenvolvimento.blogspot.com/2019/09/dicas-2328-windev-webdev-mobile-barra.html
// btn_Barra_progresso
PROGBAR_Progress_bar..MaxValue=HNbRec(cliente) // numero de registros
PROGBAR_Progress_bar..MinValue=0
nContador is int=0
PROGBAR_Progress_bar..Visible=True
FOR EACH cliente
nContador++
PROGBAR_Progress_bar=nContador
END
PROGBAR_Progress_bar..Visible=False
amarildo
27 Sep. 2019
Exemplo Quantidade Registros
Exemplo Quantidade Registros

_numero_registros is int= HNbRec(cliente)
Info(_numero_registros)

//Blog com Exemplo e video
http://windevdesenvolvimento.blogspot.com.br/2016/07/windev-21-hyperfile-hnbrec-quantidade.html
https://www.youtube.com/watch?v=t_hk176KDbg
De matos AMARILDO
16 Jul. 2016

Last update: 06/04/2024

Send a report | Local help