I have used this before but I am not sure how to handle this. I am trying to check the DataType of a column in a grid and the following works.
IF oColumn:DataType:ToString() = "System.Decimal" THEN
Could I use the EnumHelper to do this test?
IF EnumHelper:AreEqual( oColumn:DataType, System.Type:Decimal) THEN
Could I use the EnumHelper to do this test?
I don't think so because a System.Type is not an Enum.
Okay, Thanks. I thought I was missing something.
However, I'd rather compare the System.Type to Progress.Util.TypeHelper:GetType ("System.Decimal") .
You can try
TYPE-OF(Column:DataType, System.Decimal)
You can try
TYPE-OF(Column:DataType, System.Decimal)
Won't work.
This would check if a System.Type (whatever sticks in the DataType property is a System.Type instance) is a subtype of System.Decimal - and that will always return false.
Oooops, should be
TYPE-OF(Column:Value, System.Decimal)
Oooops, should be
>
TYPE-OF(Column:Value, System.Decimal)
At least for the Infragistics Grid that won't work: A Column does not have a value. A Cell has. But that might not be available without data.
TypeHelper:GetType () is the way to go.
You are correct. Just be careful with the casing as GetType will fail if the case is wrong.
In this case, I prefer;
IF oColumn:DataType:ToString() = "System.Decimal" THEN
You are correct. Just be careful with the casing as GetType will fail if the case is wrong.
Unfortunately that's true. It's bad that we have to pass in a quoted Type name.
If you want this changed, complain about this whenever you talk to someone from PSC. We need a typeof function as in C# (no dash here) where the attribute is validated at compile time and respects the USING statements as well.
By the way: The EMEA PUG Challenge was able to extend its capacities - so our registration is open again: http://www.pugchallenge.eu
A great way to discuss you needs to the language and tools with top Progress people (such as "Ms. GUI for .NET" Shelley Chase and "Mr. everything else" Ken Wilner).