Recents

 


When None ClauseOfficial Content

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

Syntax#

When None
         
<CodeWhenNone>

Description#

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.

Note:#

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.

Example#

Use of this clause is in the numbering procedure

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

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

Scope#

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

See Also#

For Each command (X Evolution 2)For Each command (XEv3)
XFor Each Command
XFor First Command




Was this page helpful?
What Is This?
Your feedback about this content is important. Let us know what you think.