Automation and the Any datatype – PB Docs 125

Automation and the Any datatype

Because PowerBuilder knows nothing about the commands and
functions of the server application, it also knows nothing about
the datatypes of returned information when it compiles a program.
Expressions that access properties and call functions have a datatype
of Any. You can assign the expression to an Any variable,
which avoids datatype conversion errors.

During execution, when data is assigned to the variable, it
temporarily takes the datatype of the value. You can use the ClassName function
to determine the datatype of the Any variable
and make appropriate assignments. If you make an incompatible assignment
with mismatched datatypes, you will get a runtime error.

note.png Do not use the Any datatype unnecessarily

If you know the datatype of data returned by a server automation
function, do not use the Any datatype. You
can assign returned data directly to a variable of the correct type.

The following sample code retrieves a value from Excel and
assigns it to the appropriate PowerBuilder variable, depending on
the value’s datatype. (For an Excel 95 spreadsheet, the
row and column arguments for cells are in parentheses instead of
square brackets.)


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x