AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / ¿Cómo proceder? / Gestión de la base de datos
  • Overview
  • Method 1: Path functions
  • Example
  • Method 2: Instruction FOR EVERYTHING
  • Code example
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
Overview
Two methods can be used to perform the full browse of a data file:
Method 1: Path functions
This method uses the following WLanguage functions to loop through data files:
In this method:
  • HReadFirst is used to access the first record according to the search key.
  • HReadNext is used to access the next record (in the order of search key).
  • HOut is used to find out whether the end of file was reached.
Note You can use the HReadLast and HReadPrevious functions to perform a Reverse run.

Example

// Browse all records of Customer file
// sorted by customer name.

HReadFirst(CUSTOMER, CustomerName)
WHILE NOT HOut(CUSTOMER)
// Process the CUSTOMER record
HReadNext(CUSTOMER, CustomerName)
END
Method 2: Instruction FOR EVERYTHING
The FOR EACH statement loops through the records of a data file. In our case, this statement will be used to read the records found in a data file.
The FOR EACH instruction expects the following parameters:
  • the name of the data file to loop through.
  • the name of the index (or key) to sort the records.
The first record and the next record are read by the FOR EACH statement. There is no need to use the HReadXXX functions.
Note The word DESC can be used to perform a Reverse run.

Code example

// Browse all records of Customer file 
// Browse sorted by ascending name

FOR EACH CUSTOMER ON CustomerName
	// Process the CUSTOMER record
END
Versión mínima requerida
  • Versión 9
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 13/02/2025

Señalar un error o enviar una sugerencia | Ayuda local