L-force | plc designer – Lenze PLC Designer PLC Designer (R3-1) User Manual

Page 1017

Advertising
background image

L-force | PLC Designer

Programming Reference

DMS 4.1 EN 03/2011 TD29

1015

hasattribute (variable: variable,
'attribute')

When applied to a variable, its value is TRUE if this particular
attribute is specified via the {attribute} instruction in a line
before the variable's declaration.
Example
Precondition: There are two applications App1 and App2.
Variable g_globalInt is used in App1 and App2, but in App1
additionally has got an attribute 'DoCount' :
Declaration of g_globalInt in App1 :
VAR_GLOBAL

{attribute 'DoCount'}

g_globalInt : INT;
g_multiType : STRING;
END_VAR

Declaration of g_globalInt in App2 :
VAR_GLOBAL
g_globalInt : INT;
g_multiType : STRING;
END_VAR

{IF hasattribute (variable: g_globalInt, 'DoCount')}
(*the following code line will only be processed in App1,
because there variable g_globalInt has got the attribute
'DoCount'*)

g_globalInt := g_globalInt + 1;
{END_IF}

Advertising