PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → Loop through a Table
Loop through a Table
Débuté par Guillermo, 16 juin 2005 22:16 - 2 réponses
Posté le 16 juin 2005 - 22:16
Hi: Guillermo again
The following error is displayed .....
Error in Click on Button4 process, line 4.
HReadNext function called.
No browse started for item on file.
when run this code .....
micampo1 is currency
micampo2 is currency
LOOP
HReadNext(DEMO_Novedades,DEMO_Novedades.CodConcepto)
IF HOut() THEN
BREAK
END
Info("voy a leer novedad con código " + DEMO_Novedades.CodConcepto + " cantidad " + DEMO_Novedades.CantConcepto)
HReadSeek(DEMO_Tabla_Valores,DEMO_Tabla_Valores.CodConcepto,DEMO_Novedades.CodConcepto)
IF HFound(DEMO_Tabla_Valores) THEN
micampo1 = DEMO_Tabla_Valores.ValorConcepto
ELSE
micampo1 = 0
END
micampo2 = micampo2 + (micampo1 * DEMO_Novedades.CantConcepto)
END
Info(micampo2)
If I put for eg. HReadFirst or HReadSeekFirst on Demo_Novedades, before the loop, the error not occurs, but the loop begin in record nº 2
Any ideas ? ... Thanks .... Guillermo
Posté le 16 juin 2005 - 22:55
Rearrange your code as below. Once you have read the first record, process it and AFTER that, READ the NEXT record
Hi: Guillermo again
The following error is displayed .....
Error in Click on Button4 process, line 4.
HReadNext function called.
No browse started for item on file.
when run this code .....
micampo1 is currency
micampo2 is currency

hreadfirst((DEMO_Novedades,DEMO_Novedades.CodConcepto)
LOOP
IF HOut() THEN
BREAK
END
Info("voy a leer novedad con código " + DEMO_Novedades.CodConcepto + " cantidad " + DEMO_Novedades.CantConcepto)
HReadSeek(DEMO_Tabla_Valores,DEMO_Tabla_Valores.CodConcepto,DEMO_Novedades.CodConcepto)
IF HFound(DEMO_Tabla_Valores) THEN
micampo1 = DEMO_Tabla_Valores.ValorConcepto
ELSE
micampo1 = 0
END
micampo2 = micampo2 + (micampo1 * DEMO_Novedades.CantConcepto)
HReadNext(DEMO_Novedades,DEMO_Novedades.CodConcepto)
END
Info(micampo2)
If I put for eg. HReadFirst or HReadSeekFirst on Demo_Novedades, before the loop, the error not occurs, but the loop begin in record nº 2
Any ideas ? ... Thanks .... Guillermo
Posté le 17 juin 2005 - 01:08
Ok Daniel
I understand the idea.
I thought that the handling was similar to clarion, there the confusion.

Now I am trying to make work the code in Compile & Execute, which already display several errors

Thank you ............ Guillermo

Rearrange your code as below. Once you have read the first record, process it and AFTER that, READ the NEXT record
Hi: Guillermo again
The following error is displayed .....
Error in Click on Button4 process, line 4.
HReadNext function called.
No browse started for item on file.
when run this code .....
micampo1 is currency
micampo2 is currency
hreadfirst((DEMO_Novedades,DEMO_Novedades.CodConcepto)

LOOP
IF HOut() THEN
BREAK
END
Info("voy a leer novedad con código " + DEMO_Novedades.CodConcepto + " cantidad " + DEMO_Novedades.CantConcepto)
HReadSeek(DEMO_Tabla_Valores,DEMO_Tabla_Valores.CodConcepto,DEMO_Novedades.CodConcepto)
IF HFound(DEMO_Tabla_Valores) THEN
micampo1 = DEMO_Tabla_Valores.ValorConcepto
ELSE
micampo1 = 0
END
micampo2 = micampo2 + (micampo1 * DEMO_Novedades.CantConcepto)
HReadNext(DEMO_Novedades,DEMO_Novedades.CodConcepto)
END
Info(micampo2)
If I put for eg. HReadFirst or HReadSeekFirst on Demo_Novedades, before the loop, the error not occurs, but the loop begin in record nº 2
Any ideas ? ... Thanks .... Guillermo