web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :

Looping Through Enum

Teddy Herryanto (That NAV Guy) Profile Picture Teddy Herryanto (Th... 14,284 Super User 2025 Season 2

Sometimes you may need to loop through Enum. To do this, you can use List Data Type.

local procedure EnumLoop()
var
    MyEnum: Enum "My Enum";
    EnumIndex: List of [Integer];
    iMax, iLoop : Integer;
begin
    EnumIndex := ScanSource.Ordinals();
    iMax := EnumIndex.Count();

    If iMax <= 0 then
        exit;
    
    iLoop := 1;
    repeat //loop here
      MyEnum := EnumIndex.Get(iLoop);
      iLoop += 1;
    until iLoop > iMax;
end;

This was originally posted here.

Comments

*This post is locked for comments