[Progress Communities] [Progress OpenEdge ABL] Forum Post: Question about Enums

  • Thread starter Thread starter DenDuze
  • Start date Start date
Status
Not open for further replies.
D

DenDuze

Guest
Hi, I understand that you can create a cls with the definition of an enum. In my case I want to test with a Enum for the different states an item can have. In the database we already save those values but they are saved as integers (0 means "new", 1 means "replaced", ...) So now I want to use Enums for those values so that thee are better readable in the coding. I thought that those enums could be used like: if item.Status eq ItemStatus:New then .... or assign item.Status = ItemStatus:New But it looks like you can't use Enums that way. Am I correct here or is there some way that I can use them this way?. The explanation is that you can only assign an Enum to a field/variable that has that Enum-type. So I should define a variable of the type ItemStatus, assign that the value of item.Status and then check if that variable eq itemStatus:New Or I can also use the getvalue-/toString-methods to assign the value (like item.status = ItemStatus:new:getvalue()) But again, I find it strange that I just can not use : (like itemStatus:New) in a comparison or assignment. Can't the language convert this internally depending on the data-type where it's compared/assigned with? (so without the need of defining a variable of that enums-type or by using the GetValue- or GetString-method) Regards

Continue reading...
 
Status
Not open for further replies.
Back
Top