The Value of a Property vs The property Reference

Posted by GregHiggins on 21-Oct-2008 07:35

I'm attaching numTest.cls; I'm afraid it demonstrates a severe lack of knowledge on my part.

At first I thought that integer ( testInteger:Value ) was returning the integer value of the System.Object reference which is at the heart of the ultraNumericEditor:Value property, but, since pressing Save multiple times returns different values, I'm thinking that the number is actually a reference to a dynamically created reference object. (for which I can't find the documentation, so I'm probably using the wrong terminology).

My problem is, I don't know how to tell it I want the Value of the property cast as an integer, not the integer value of the System.Object reference.

[View:~/cfs-file.ashx/__key/communityserver-discussions-components-files/19/numtest.zip:550:0]

All Replies

Posted by GregHiggins on 21-Oct-2008 07:43

OK, I just hadn't hit the right sentence. I need to unbox the value.

integer ( unbox ( testInteger:Value ) )

Posted by jmls on 21-Oct-2008 16:20

 * jmls scrabbles for the help, muttering "what the hell is unbox" ...

Posted by Admin on 21-Oct-2008 16:29

From the beta docs:

Manual boxing

ABL provides a BOX function for cases where you must manually convert an ABL scalar value

to a particular .NET mapped data type, and it provides an UNBOX function for cases where you

must manually UNBOX a .NET mapped object type or a System.Object to a compatible ABL

scalar data type. There are two cases each when you must use the ABL built-in BOX or UNBOX

function to manually box or unbox a value between a .NET object type and a corresponding

ABL scalar data type:

• BOX function:

– When you assign a System.Object to an ABL scalar data type and you want the ABL

value boxed as a .NET mapped data type other than the default match

– When you pass an ABL scalar data type to a System.Object INPUT parameter of an

ABL routine (method, constructor, procedure, or user-defined function)

• UNBOX function:

– When you use a System.Object in an ABL expression

– When you pass a System.Object to an ABL scalar INPUT parameter of an ABL

routine (method, constructor, procedure, or user-defined function)

In .NET objects can also be System.String, System.DateTime, etc. when you pass such a type to/from an ABL function or method that expects CHARACTER, DATETIME, ect. (the ABL scalar types) you need to use the BOX or UNBOX function when the .NET object is defined System.Object (weak typed).

This thread is closed