Table of contents

Official Content

Specifies the code to be executed when a For Each command or Xfor Each does not filter any record.


When None


It is often necessary to execute a certain code when a For Each or Xfor Each does not filter any record.

To simplify the logic of the For Each and to provide more programming clarity, the command When None can be used.


It is important to clarify that if For Eachs are included within a When None, neither joins nor any type of filter will be inferred with respect to the For Each that includes the When None command.


Use of this clause is in the numbering procedure

For each
    where NumCode = &code
           &LastNum = LastNum + 1
           LastNum = &LastNum
    when none
           &LastNum = 1
                  NumCode = &code
                  LastNum = &LastNum

In this example, you update the last number for the document specified by &code, If the record does not exist, you insert it in the table.


Commands: For each command (XEv2, XEv3), XFor Each, XFor First

See Also

For Each commandFor Each command (XEv3)
XFor Each Command
XFor First Command

Last update: November 2023 | © GeneXus. All rights reserved. GeneXus Powered by Globant