PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → wd19 - browse an array of structure and delete elements
wd19 - browse an array of structure and delete elements
Iniciado por guest, 07,abr. 2015 12:05 - 1 respuesta
Publicado el 07,abril 2015 - 12:05
Hi,

I have an array of structures and based on the value of one or more items, some of the array elements needs to be deleted.

ST_Test is structure
sName is string
nAge is int
end

sTest is ST_Test
arrTest is array of ST_Test
... file arrTest here

Say arrTest holds 5 elements and I want of delete all elements where nAge<25
FOR EACH sTest OF arrTest
IF sTest.nAge < 25
ArrayDelete(arrTest)
END
END

When I do this the FOR-EACH loop is affected. And skips some of the rows.
Publicado el 07,abril 2015 - 12:16
As usual,
Solved a problem while trying to explain it.
It works as expected when using using

FOR EACH sTest OF arrTest FromEnd
END