Hey Guys,
Coming from a .Net background I'm fairly new to the world of cache. I'd like to emulate an enum like behaviour in cache.
For Instance,
I'd like to do something to this effect
MyCacheObject.MyProperty = MyEnumType.Enum
So if i had a class as follows
Class MedicareClaim.Service Extends (%RegisteredObject, %XML.Adaptor)
{
Property ServiceTypeCode As ClaimEnum.ServiceTypeCodeEnum (MAXLEN = 2, XMLNAME = "serviceTypeCde", XMLPROJECTION = "ATTRIBUTE");
}
Class EasyClaimEnum.ServiceTypeCodeEnum Extends %String
{
/*Definition of the enum here*/
/*Possible enum values o,s,d,p*/
/*DisplayList: GeneralPractitioner, Specialist, Diagnostic Imaging,Pathology
*/
}
In the method that service class, I'd like to do something like this:
Set Service = ##class(MedicareClaim.Service).%New()
Set Service.ServiceTypeCode = ##class(ClaimEnum.ServiceTypeCodeEnum ).DiagnosticImaging
(ServiceTypeCode should now hold the value d)
Is there any way to achieve this or something similar to this?
Any help is greatly appreciated.
Thanks and Regards,
Laavanya
--
--
Caché, Ensemble, DeepSee
---
You received this message because you are subscribed to the Google Groups "Caché, Ensemble, DeepSee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to intersystems-publi...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Maybe there is a better solution but i have not found it (yet).
Laavanya,
You might have success with using Parameters in a DataType class.
Class Hack.EnumString Extends %String
{
Parameter DiagnosticImaging =
"d";
...
}
Please take a look at my sample classes: http://pastebin.com/93bGMxBC
In the Test() method of my Hack.EnumTest class, Caché Studio apparently only uses intellisense for the first property, which is a %String type. (I don’t know why it doesn’t happen with the other two properties that are user-defined types.) But it looks something like this as soon as you enter “.#” at the end of the line, allowing you to select the code description:
set obj.MyEnum=##class(Hack.EnumType).#
DiagnosticImaging
GeneralPractitioner
Pathology
Specialist
-Keith
--
--
Caché, Ensemble, DeepSee
---
You received this message because you are subscribed to the Google Groups "Caché, Ensemble, DeepSee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
intersystems-publi...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
To unsubscribe from this group and stop receiving emails from it, send an email to intersystems-public-cache+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Class Hack.EnumString Extends (%RegisteredObject,%String)
{
Parameter DiagnosticImaging = "d";
...
}
Unless you could get this to work with having to extend the %RegisteredObject class, in which case I am very curious to know how.To unsubscribe from this group and stop receiving emails from it, send an email to intersystems-public-cache+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.