Cancel
Showing results for 
Search instead for 
Did you mean: 

How to access an "user defined attribute" placed inside a method through another method?

Builder
Builder

There´s a method that contains an user defined attribute type boolean called "my_attribute".

 

I want to print it through another method using the code:

print method.my_attribute;

 

plant simulation reports the following message:

A "void" cannot accept the method "my_attibute".

 

How can I cope with that?

2 REPLIES

Re: How to access an "user defined attribute" placed inside a method through another metho

Genius
Genius

This happens because when you write the method name, it executes the method. For this you require to set a reference to that method.

For this you assign the method to a variable of data type object..

 

See '&' or 'ref' in help..

 

Your case can look something like this...

var meth : object
meth:= &myMethod

print meth.myattribute

Re: How to access an "user defined attribute" placed inside a method through another metho

Builder
Builder

Good. Solved my problem. Thanks a lot!!!