I have a requirement to create a System.Enum and populate it with up to 12 members as I'm trying to populate Microsoft.Win32.TaskScheduler.MonthlyTrigger:MonthsOfYear which accepts a System.Enum.
The problem I'm having is I can't seem to find an example of how to get more than two items into my Enum, other than an example I found on this forum, using the OR of the OE EnumHelper and then calling the EnumHelper again with the output of the first!;
DEFINE VARIABLE rEnum AS System.Enum NO-UNDO.
rEnum = EnumHelper:Or(Microsoft.Win32.TaskScheduler.MonthsOfTheYear:January, Microsoft.Win32.TaskScheduler.MonthsOfTheYear:February). mt:MonthsOfYear = CAST(EnumHelper:Or(rEnum, Microsoft.Win32.TaskScheduler.MonthsOfTheYear:March), Microsoft.Win32.TaskScheduler.MonthsOfTheYear).
Is there a better way of doing this?
ASSIGN rEnum = MonthsOfTheYear:AllMonths.
If you're on 11.7 you can use OR.
ASSIGN rEnum = MonthsOfTheYear:January OR MonthsOfTheYear:February OR MonthsOfTheYear:August OR MonthsOfTheYear:September OR MonthsOfTheYear:November .
Thanks for this :-)
I'm on OE102B however.
Sorry, I should have mention this in my post.
I've written a function that does what I want but it's a bit messy.
If you need more than two, you need to stack the use of the EnumHelper:
rEnum = EnumHelper:Or(EnumHelper:Or(Microsoft.Win32.TaskScheduler.MonthsOfTheYear:January, Microsoft.Win32.TaskScheduler.MonthsOfTheYear:February), Microsoft.Win32.TaskScheduler.MonthsOfTheYear:March).
Architect of the SmartComponent Library and WinKit
Yes that's whay I've done.