Cancel
Showing results for 
Search instead for 
Did you mean: 

Check if attribute is writable

Valued Contributor
Valued Contributor

Hi,

 

is there a possibility to check if a attribute is writable during the runtime ? So in a Method

I need something like this:

 

if isWriable(AngularConverter.EnergyCurrentState) then ... end;

 

I need this for an external Programm which needs to check which attributes it can write and only read.

2 REPLIES

Re: Check if attribute is writable

Siemens Phenom Siemens Phenom
Siemens Phenom

Hello Readock,

 

you can use the following trick:

is
do
	print executeSilent(":boolean is do SingleProc.Full := SingleProc.Full; return true; end;");
	print executeSilent(":boolean is do SingleProc.Name := SingleProc.Name; return true; end;");
end;

 The executeSilent command can be used to execute SimTalk code without generating an error code.

In the first case the assignment to the attribute Full is not valid so the return statement which returns true is not reached. Therefore the default value for a boolean (false) is returned.

 

But be aware that the inheritance for the attribute is turned off and there is no way to turn it on again using SimTalk.

 

Regards,

Ralf

Regards,

Ralf
------------------------------------------------------------------------------------------------------
Did you like the answer? Then click the Thumbs Up button.
Did the answer solve your problem? Then accept the answer as solution.

Re: Check if attribute is writable

Valued Contributor
Valued Contributor
thx that is what i was surching for Smiley Happy