by
allistar >> Fri, 10 Jan 2003 2:29:48 GMT
how can I find the type of a property of a class.
i.e I have a property from PropertyNDict and i need to know what type of data it is ( REAL, DATE INTEGER etc).
The Property class has a "type" property (of type Type). (Try and say that fast!).
When comparing types it's best to compare the names of primitive types rather than actual types themselves, e.g:
//don't do:
if (property.type = Integer) then
//do something
endif;
//instead do:
if (property.type.name = "Integer") then
//do something
endif;
This is because the Integer class object is different depending on
what schema you are in. I.e. there is an Integer class object for RootSchema and one for your subschema as well, so the comparison may
fail even when you want it to succeed.
Here is a hint for getting all properties on a class:
vars
property: Property;
cls: Class;begin
cls := Supplier;
foreach property in cls.allProperties do
write property.name & " - " & property.type.name;
endforeach;
end;
You may find that handy.
Regards,
Allistar.
------------------------------------------------------------------
Allistar Melville
Software Developer
Auckland, NEW ZEALAND
Greentree International,
Developer of Greentree Financial Software. ------------------------------------------------------------------