Forum Post: RE: PaperSize CAST not working

  • Thread starter Thread starter Laura Stern
  • Start date Start date
Status
Not open for further replies.
L

Laura Stern

Guest
clsPaperSize:RawKind is an integer. CrystalDecisions.Shared.PaperSize is an Enumerator whose underlying value is an integer. In the ABL you cannot use CAST to change an integer into an Enumerator. In fact you cannot use CAST on an integer, period. This is different than in C#. The way to do this would be to use the static ToObject method on System.Enum. It takes a System.Type object, which would be the Type for a CrystalDecisions.Shared.PaperSize Enum and an integer which is the underlying value. It will convert the specified 32-bit signed integer to an enumeration member. Then you can assign it. To get the Type object, you'd have to use Progress.Util.TypeHelper.GetType(" CrystalDecisions.Shared.PaperSize"). It might also be possible to do "NEW CrystalDecisions.Shared.PaperSize(clsPaperSize:RawKind)". Not sure if you can do this, but if you can, it would give you an instance of the enum from the underlying value and then you can assign it. A 3rd, non-elegant way to do this would be to use a CASE statement on the clsPaperSize:RawKind value and do the appropriate assignment within each case.

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