1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Stackoverflow]

Discussão em 'StackOverflow' iniciado por fdantas, Outubro 23, 2024.

  1. fdantas

    fdantas Administrator Moderador

    I am struggling with getting only first 2 records from a table via FOR EACH. My goal is to read only first 2 records from a table, and save one field value to the variables.

    Let's say I have the table MyTable with fields PartNr, CreationDate, Company, ID.

    My FOR EACH statement would look like this:

    FOR EACH MyTable
    WHERE MyTable.Company = "TestCompany"
    AND MyTable.CreationDate >= 01.01.2021
    NO-LOCK:

    END.


    That FOR EACH statement would find 15 records for example. I however only need the first two. I would like to store the PartNr of the first record in a variable, and the PartNr of the second record in another variable.

    After that the FOR EACH statement should end.

    I have tried using FIND FIRST as well, but I don't know how to get the second record then.

    I am pretty much looking for a python equivalent of break keyword when using loops.

    Any help is much appreciated.

    Continue reading...

Compartilhe esta Página