<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html class="client-nojs" dir="ltr" lang="en">
<head>
<meta charset="UTF-8" />
<title>Documents/User API - OpenSCADAWiki</title>
<meta content="MediaWiki 1.26.4" name="generator" />
<link href="https://www.gnu.org/copyleft/fdl.html" rel="copyright" />
<link href="files/doc.css" rel="stylesheet" /></head>
<body><div class="floatright"><a href="index.html"><img alt="OpenSCADA" src="../en/files/index.png" /></a></div><div id="mw_header">
			<div class="mw-indicators">
</div>
			<h1 id="firstHeading" lang="en">Documents/User API</h1>
		</div><div class="mw-content-ltr" dir="ltr" id="mw-content-text" lang="en"><div class="mw-pt-languages" dir="ltr" lang="en"><div class="mw-pt-languages-list autonym"><span class="mw-pt-languages-ui mw-pt-languages-selected mw-pt-progress mw-pt-progress--complete">English</span>&nbsp;• ‎<a class="mw-pt-progress mw-pt-progress--high" href="../ru/User_API.html" title="Документация/API пользователя (79% translated)">mRussian</a>&nbsp;• ‎<a class="mw-pt-progress mw-pt-progress--complete" href="../uk/User_API.html" title="Документація/API користувача (100% translated)">Українська</a></div></div>
<div style="float:right; border:1px solid gray; width:300px; padding:2px; margin-left: 10pt; margin-bottom: 10pt;">
<ul><li> <b>Author:</b> <a class="external" href="http://oscada.org/wiki/User:RomanSavochenko" title="User:RomanSavochenko">Roman Savochenko</a><br />&nbsp;&nbsp;<font size="-2"><i>Maxim Lysenko (2012) — the page initial translation</i></font></li>
<li> <b>Initially created:</b> in <a class="external text" href="http://wiki.oscada.org/HomePageEn/Doc/ProgrammManual" rel="nofollow noreferrer noopener" target="_blank">the old Wiki</a> </li></ul>
</div>
<p>Before programming in OpenSCADA, you must examine the object structure of the program (Object Model) in the <a href="Program_manual.html" title="Special:MyLanguage/Documents/Program manual">OpenSCADA Program Manual</a> and in Figure 1.
</p>
<div class="center"><div class="thumb tnone"><div class="thumbinner" style="width:1202px;"><a class="image" href="http://oscada.org/wiki/File:Oscada_UserOM.png"><img class="thumbimage" height="540" src="files/Oscada_UserOM.png" width="1200" /></a>  <div class="thumbcaption">Fig. 1. User object model of the core OpenSCADA.</div></div></div></div>
<p>From this document you will see that you can program next parts of OpenSCADA as the user:
</p>
<ul><li> <a href="DAQ.html#Virtual" title="Special:MyLanguage/Documents/DAQ">Logical level sources of the subsystem "DAQ"</a>.</li>
<li> Transport protocols allowed for user programming that is: <a href="Modules/UserProtocol.html" title="Special:MyLanguage/Modules/UserProtocol">User protocol</a>, <a href="Modules/ModBus.html" title="Special:MyLanguage/Modules/ModBus">ModBus nodes of the type "Data"</a>, <a href="Modules/WebUser.html" title="Special:MyLanguage/Modules/WebUser">Web-interfaces from the user</a>, ...</li>
<li> <a href="Modules/VCAEngine.html" title="Special:MyLanguage/Modules/VCAEngine">Visual Control Area (VCA)</a> in procedures of the widgets.</li></ul>
<p>User programming API is the tree of the OpenSCADA objects (Fig.1), every object of which can provide own list of properties and functions. Properties and functions of the objects can be used by the user in procedures on the languages of the user programming of OpenSCADA.
</p><p>Currently OpenSCADA provides only one language of the text programming — <a href="#JavaLikeCalc">JavaLikeCalc</a> then you must learn it also before the starting! The entry point for access to the objects of OpenSCADA (Fig.1) from the user programming language JavaLikeCalc is the reserved word "SYS" of the root OpenSCADA object. For example, to access the function of output transport you should write: <b>SYS.Transport.Serial.out_ModBus.messIO(mess);</b>.
</p><p>API of the objects provided by the modules is described in the own documentation of the modules and here links to their are provided.
</p>
<div class="toc" id="toc"><div id="toctitle"><h2>Contents</h2></div>
<ul>
<li class="toclevel-1 tocsection-1"><a href="#The_user_programming_language_JavaLikeCalc"><span class="tocnumber">1</span> <span class="toctext"><span>The user programming language JavaLikeCalc</span></span></a>
<ul>
<li class="toclevel-2"><a href="#Elements_of_the_language"><span class="tocnumber">1.1</span> <span class="toctext">Elements of the language</span></a></li>
<li class="toclevel-2"><a href="#Operations_of_the_language"><span class="tocnumber">1.2</span> <span class="toctext">Operations of the language</span></a></li>
<li class="toclevel-2"><a href="#Embedded_functions_of_the_language"><span class="tocnumber">1.3</span> <span class="toctext">Embedded functions of the language</span></a></li>
<li class="toclevel-2"><a href="#Operators_of_the_language"><span class="tocnumber">1.4</span> <span class="toctext">Operators of the language</span></a>
<ul>
<li class="toclevel-3"><a href="#Conditional_operators"><span class="tocnumber">1.4.1</span> <span class="toctext">Conditional operators</span></a></li>
<li class="toclevel-3"><a href="#Loops"><span class="tocnumber">1.4.2</span> <span class="toctext">Loops</span></a></li>
<li class="toclevel-3"><a href="#Internal_functions"><span class="tocnumber">1.4.3</span> <span class="toctext">Internal functions</span></a></li>
<li class="toclevel-3"><a href="#Special_characters_of_the_string_variables"><span class="tocnumber">1.4.4</span> <span class="toctext">Special characters of the string variables</span></a></li>
</ul>
</li>
</ul>
</li>
<li class="toclevel-1 tocsection-2"><a href="#System-wide_user_objects"><span class="tocnumber">2</span> <span class="toctext"><span>System-wide user objects</span></span></a>
<ul>
<li class="toclevel-2 tocsection-3"><a href="#Array_object"><span class="tocnumber">2.1</span> <span class="toctext"><span>Array object</span></span></a></li>
<li class="toclevel-2 tocsection-4"><a href="#RegExp_object"><span class="tocnumber">2.2</span> <span class="toctext"><span>RegExp object</span></span></a></li>
<li class="toclevel-2 tocsection-5"><a href="#XML_node-tag_object_.28XMLNodeObj.29"><span class="tocnumber">2.3</span> <span class="toctext">XML node-tag object (XMLNodeObj)</span></a></li>
</ul>
</li>
<li class="toclevel-1 tocsection-6"><a href="#Program-system_.28SYS.29"><span class="tocnumber">3</span> <span class="toctext"><span>Program-system (SYS)</span></span></a></li>
<li class="toclevel-1 tocsection-7"><a href="#Any_object_.28TCntrNode.29_of_OpenSCADA_objects_tree_.28SYS..2A.29"><span class="tocnumber">4</span> <span class="toctext"><span>Any object (TCntrNode) of OpenSCADA objects tree (SYS.*)</span></span></a></li>
<li class="toclevel-1 tocsection-8"><a href="#Subsystem_.22Security.22_.28SYS.Security.29"><span class="tocnumber">5</span> <span class="toctext">Subsystem "Security" (SYS.Security)</span></a></li>
<li class="toclevel-1 tocsection-9"><a href="#Subsystem_.22DB.22_.28SYS.BD.29"><span class="tocnumber">6</span> <span class="toctext"><span>Subsystem "DB" (SYS.BD)</span></span></a></li>
<li class="toclevel-1 tocsection-10"><a href="#Subsystem_.22DAQ.22_.28SYS.DAQ.29"><span class="tocnumber">7</span> <span class="toctext"><span>Subsystem "DAQ" (SYS.DAQ)</span></span></a>
<ul>
<li class="toclevel-2 tocsection-11"><a href="#Module_DAQ.JavaLikeCalc"><span class="tocnumber">7.1</span> <span class="toctext">Module DAQ.JavaLikeCalc</span></a></li>
<li class="toclevel-2 tocsection-12"><a href="#Module_DAQ.LogicLev"><span class="tocnumber">7.2</span> <span class="toctext">Module DAQ.LogicLev</span></a></li>
<li class="toclevel-2 tocsection-13"><a href="#Module_DAQ.BlockCalc"><span class="tocnumber">7.3</span> <span class="toctext">Module DAQ.BlockCalc</span></a></li>
<li class="toclevel-2 tocsection-14"><a href="#Module_DAQ.ModBus"><span class="tocnumber">7.4</span> <span class="toctext">Module DAQ.ModBus</span></a></li>
<li class="toclevel-2 tocsection-15"><a href="#Module_DAQ.Siemens"><span class="tocnumber">7.5</span> <span class="toctext">Module DAQ.Siemens</span></a></li>
<li class="toclevel-2 tocsection-16"><a href="#Module_DAQ.OPC_UA"><span class="tocnumber">7.6</span> <span class="toctext">Module DAQ.OPC_UA</span></a></li>
</ul>
</li>
<li class="toclevel-1 tocsection-17"><a href="#Subsystem_.22Archives-History.22_.28SYS.Archive.29"><span class="tocnumber">8</span> <span class="toctext"><span>Subsystem "Archives-History" (SYS.Archive)</span></span></a></li>
<li class="toclevel-1 tocsection-18"><a href="#Subsystem_.22Transports.22_.28SYS.Transport.29"><span class="tocnumber">9</span> <span class="toctext"><span>Subsystem "Transports" (SYS.Transport)</span></span></a></li>
<li class="toclevel-1 tocsection-19"><a href="#Subsystem_.22Protocols.22_.28SYS.Protocols.29"><span class="tocnumber">10</span> <span class="toctext">Subsystem "Protocols" (SYS.Protocols)</span></a>
<ul>
<li class="toclevel-2 tocsection-20"><a href="#Module_Protocol.HTTP"><span class="tocnumber">10.1</span> <span class="toctext">Module Protocol.HTTP</span></a></li>
</ul>
</li>
<li class="toclevel-1 tocsection-21"><a href="#Subsystem_.22User_interfaces.22_.28SYS.UI.29"><span class="tocnumber">11</span> <span class="toctext"><span>Subsystem "User interfaces" (SYS.UI)</span></span></a>
<ul>
<li class="toclevel-2 tocsection-22"><a href="#Module_QTStarter"><span class="tocnumber">11.1</span> <span class="toctext">Module QTStarter</span></a></li>
<li class="toclevel-2 tocsection-23"><a href="#Module_UI.VCAEngine"><span class="tocnumber">11.2</span> <span class="toctext">Module UI.VCAEngine</span></a></li>
</ul>
</li>
<li class="toclevel-1 tocsection-24"><a href="#.22Special.22_subsystem_.28SYS.Special.29"><span class="tocnumber">12</span> <span class="toctext">"Special" subsystem (SYS.Special)</span></a>
<ul>
<li class="toclevel-2 tocsection-25"><a href="#Module_Library_of_the_system_API_of_the_user_programming_area_.28Special.FLibSYS.29"><span class="tocnumber">12.1</span> <span class="toctext">Module Library of the system API of the user programming area (Special.FLibSYS)</span></a></li>
<li class="toclevel-2 tocsection-26"><a href="#Module_Library_of_standard_mathematical_functions_.28Special.FLibMath.29"><span class="tocnumber">12.2</span> <span class="toctext">Module Library of standard mathematical functions (Special.FLibMath)</span></a></li>
<li class="toclevel-2 tocsection-27"><a href="#Module_Library_of_functions_of_compatibility_with_SCADA_Complex1_of_the_firm_DIYA_Ltd_.28Special.FLibComplex1.29"><span class="tocnumber">12.3</span> <span class="toctext">Module Library of functions of compatibility with SCADA Complex1 of the firm DIYA Ltd (Special.FLibComplex1)</span></a></li>
</ul>
</li>
<li class="toclevel-1 tocsection-28"><a href="#Libraries_of_the_user_functions"><span class="tocnumber">13</span> <span class="toctext">Libraries of the user functions</span></a></li>
<li class="toclevel-1 tocsection-29"><a href="#Links"><span class="tocnumber">14</span> <span class="toctext">Links</span></a></li>
</ul>
</div>

<h2><span class="mw-headline" id="The_user_programming_language_JavaLikeCalc"><span class="mw-headline-number">1</span> <span id="JavaLikeCalc" title="#JavaLikeCalc"><a href="Modules/JavaLikeCalc.html" title="Special:MyLanguage/Modules/JavaLikeCalc">The user programming language JavaLikeCalc</a></span></span></h2>
<h3><span class="mw-headline" id="Elements_of_the_language"><span class="mw-headline-number">1.1</span> Elements of the language</span></h3>
<p><i>Keywords:</i> <b>if</b>, <b>else</b>, <b>while</b>, <b>for</b>, <b>in</b>, <b>break</b>, <b>continue</b>, <b>return</b>, <b>function</b>, <b>using</b>.<br />
<i>Constants:</i>
</p>
<ul><li> decimal: digits <b>0-9</b> (12, 111, 678);</li>
<li> octal: digits <b>0-7</b> (012, 011, 076);</li>
<li> hexadecimal: digits <b>0-9</b>, letters <b>a-f</b> or <b>A-F</b> (0x12, 0XAB);</li>
<li> real: <b>345.23</b>, <b>2.1e5</b>, <b>3.4E-5</b>, <b>3e6</b>;</li>
<li> boolean: <b>true</b>, <b>false</b>;</li>
<li> string: <b>"hello"</b>, without going to the next line, however, with the support of direct concatenation of the string constants.</li></ul>
<p><i>Types of variables:</i>
</p>
<ul><li> integer: <b>-2<sup>63</sup></b> ... <b>2<sup>63</sup></b>, <b>EVAL_INT</b>(-9223372036854775807);</li>
<li> real: <b>3.4*10<sup>308</sup></b>, <b>EVAL_REAL</b>(-1.79E308);</li>
<li> Boolean: <b>false</b>, <b>true</b>, <b>EVAL_BOOL</b>(2);</li>
<li> string: a sequence of character-bytes (0...255) of any length, limited by the capacity of the memory and DB storage; <b>EVAL_STR</b>("&lt;EVAL&gt;").</li></ul>
<p><i>Built-in constants:</i> <b>pi</b> = 3.14159265..., <b>e</b> = 2.71828182..., <b>EVAL_BOOL</b>(2), <b>EVAL_INT</b>(-9223372036854775807), <b>null</b>,<b>EVAL</b>,<b>EVAL_REAL</b>(-1.79E308), <b>EVAL_STR</b>("&lt;EVAL&gt;")<br />
<i>Global attributes of the DAQ parameter (starting from the subsystem "DAQ", as follows <b>{Type of DAQ module}.{Controller}.{Parameter}.{Attribute}</b>).</i><br />
<i>The functions and parameters of <a href="User_API.html" title="Special:MyLanguage/Documents/User API">the object model of OpenSCADA</a>.</i>
</p><p><a class="image" href="http://oscada.org/wiki/File:At.png"><img alt="At.png" height="22" src="files/At.png" width="22" /></a> The <b>EVAL</b> (Error VALue) variants and <b>null</b> are processed specially in conversion one to one depending on used the base type, that is you are free in use only <b>null</b> or <b>EVAL</b> for any cases.
</p>
<h3><span class="mw-headline" id="Operations_of_the_language"><span class="mw-headline-number">1.2</span> Operations of the language</span></h3>
<p>The operations supported by the language are presented in the table below. Priority of the operations is reduced from top to bottom. Operations with the same priority are in the same color group.
</p>
<table bgcolor="#FFFFF0" border="1" cellspacing="0">
<tr align="center" bgcolor="#83D8FF"><td><b>Symbol</b></td><td><b>Description</b></td></tr>
<tr bgcolor="#FFFFC0"><td>()</td><td>Call of function.</td></tr>
<tr><td>{}</td><td>Program blocks.</td></tr>
<tr><td>++</td><td>Increment (post and pre).</td></tr>
<tr><td>--</td><td>Decrement (post and pre).</td></tr>
<tr bgcolor="#FFFFC0"><td>-</td><td>Unary minus.</td></tr>
<tr bgcolor="#FFFFC0"><td>!</td><td>Logical negation.</td></tr>
<tr bgcolor="#FFFFC0"><td>~</td><td>Bitwise negation.</td></tr>
<tr><td>*</td><td>Multiplication.</td></tr>
<tr><td>/</td><td>Division.</td></tr>
<tr><td>%</td><td>Remainder of integer division.</td></tr>
<tr bgcolor="#FFFFC0"><td>+</td><td>Addition</td></tr>
<tr bgcolor="#FFFFC0"><td>-</td><td>Subtraction</td></tr>
<tr><td>&lt;&lt;</td><td>Bitwise shift left</td></tr>
<tr><td>&gt;&gt;</td><td>Bitwise shift right</td></tr>
<tr bgcolor="#FFFFC0"><td>&gt;</td><td>Greater</td></tr>
<tr bgcolor="#FFFFC0"><td>&gt;=</td><td>Greater than or equal to</td></tr>
<tr bgcolor="#FFFFC0"><td>&lt;</td><td>Less</td></tr>
<tr bgcolor="#FFFFC0"><td>&lt;=</td><td>Less than or equal to</td></tr>
<tr bgcolor="#FFFFC0"><td>==</td><td>Equals</td></tr>
<tr bgcolor="#FFFFC0"><td>!=</td><td>Unequal</td></tr>
<tr><td>|</td><td>Bitwise "OR"</td></tr>
<tr><td>&amp;</td><td>Bitwise "AND"</td></tr>
<tr><td>^</td><td>Bitwise "Exclusive OR"</td></tr>
<tr bgcolor="#FFFFC0"><td>&amp;&amp;</td><td>Boolean "AND"</td></tr>
<tr bgcolor="#FFFFC0"><td>||</td><td>Boolean "OR"</td></tr>
<tr><td>?:</td><td>Conditional operation "i=(i&lt;0)?0:i;"</td></tr>
<tr bgcolor="#FFFFC0"><td>=</td><td>Assignment.</td></tr>
<tr bgcolor="#FFFFC0"><td>+=</td><td>Assignment with addition.</td></tr>
<tr bgcolor="#FFFFC0"><td>-=</td><td>Assignment with subtraction.</td></tr>
<tr bgcolor="#FFFFC0"><td>*=</td><td>Assignment with multiplication.</td></tr>
<tr bgcolor="#FFFFC0"><td>/=</td><td>Assignment with division.</td></tr>
</table>
<h3><span class="mw-headline" id="Embedded_functions_of_the_language"><span class="mw-headline-number">1.3</span> Embedded functions of the language</span></h3>
<p>The virtual machine of the language provides the following set of built-in functions general-purpose:
</p>
<ul><li> <i>double max(double x, double x1)</i> — maximum value of <i>x</i> and <i>x1</i>;</li>
<li> <i>double min(double x, double x1)</i> — minimum value of <i>x</i> and <i>x1</i>;</li>
<li> <i>string typeof(ElTp vl)</i> — type of the value <i>vl</i>;</li>
<li> <i>string tr(string base)</i> — translation to the <i>base</i> message.</li></ul>
<p>To provide high speed work in mathematical calculations, the module provides built-in mathematical functions that are called at the level of the commands of the virtual machine:
</p>
<ul><li> <i>double sin(double x)</i> — sine <i>x</i>;</li>
<li> <i>double cos(double x)</i> — cosine <i>x</i>;</li>
<li> <i>double tan(double x)</i> — tangent <i>x</i>;</li>
<li> <i>double sinh(double x)</i> — hyperbolic sine of <i>x</i>;</li>
<li> <i>double cosh(double x)</i> — hyperbolic cosine of <i>x</i>;</li>
<li> <i>double tanh(double x)</i> — hyperbolic tangent of <i>x</i>;</li>
<li> <i>double asin(double x)</i> — arcsine of <i>x</i>;</li>
<li> <i>double acos(double x)</i> — arc cosine of <i>x</i>;</li>
<li> <i>double atan(double x)</i> — arctangent of <i>x</i>;</li>
<li> <i>double rand(double x)</i> — random number from 0 to <i>x</i>;</li>
<li> <i>double lg(double x)</i> — decimal logarithm of <i>x</i>;</li>
<li> <i>double ln(double x)</i> — natural logarithm of <i>x</i>;</li>
<li> <i>double exp(double x)</i> — exponent of <i>x</i>;</li>
<li> <i>double pow(double x, double x1)</i> — erection of x to the power <i>x1</i>;</li>
<li> <i>double sqrt(double x)</i> — the square root of <i>x</i>;</li>
<li> <i>double abs(double x)</i> — absolute value of <i>x</i>;</li>
<li> <i>double sign(double x)</i> — sign of <i>x</i>;</li>
<li> <i>double ceil(double x)</i> — rounding the number <i>x</i> to a greater integer;</li>
<li> <i>double floor(double x)</i> — rounding the number <i>x</i> to a smaller integer.</li></ul>
<h3><span class="mw-headline" id="Operators_of_the_language"><span class="mw-headline-number">1.4</span> Operators of the language</span></h3>
<p>The total list of the operators of the language:
</p>
<ul><li> <i>var</i> — operator of initialization of a variable; specifying a variable without assigning a value sets it to <b>null</b>-<b>EVAL</b>, which allows for one-time initialization of complex data types, such as an object, through the direct comparing and checking by <i>isEVal()</i>;</li>
<li> <i>if</i> — operator "IF" of the condition;</li>
<li> <i>else</i> — operator "ELSE" of the condition;</li>
<li> <i>while</i> — definition of the "WHILE" loop;</li>
<li> <i>for</i> — definition of the "FOR" loop;</li>
<li> <i>in</i> — separator of the "FOR" cycle for object's properties scan;</li>
<li> <i>break</i> — interruption of the cycle;</li>
<li> <i>continue</i> — continue the cycle from the beginning;</li>
<li> <i>function</i> — definition of the internal function;</li>
<li> <i>using</i> — allows you to set the visibility space of the external functions of the often used libraries (<b>using Special.FLibSYS;</b>) for the next access only by the name of the function, has no effect for object access;</li>
<li> <i>return</i> — interrupt function and return the result that is copied to an attribute marked as return one (<b>return 123;</b>); in the middle of the internal function it is completed with a definite result;</li>
<li> <i>new</i> — creating an object, implemented for: the generic object "Object", massif "Array" and regular expressions "RegExp".</li>
<li> <i>delete</i> — delete/free of an object or its properties, while: internal variables are set in <b>null</b>-<b>EVAL</b>, external ones are replaced by an empty object, and the properties of the object are cleared.</li></ul>
<h4><span class="mw-headline" id="Conditional_operators"><span class="mw-headline-number">1.4.1</span> Conditional operators</span></h4>
<p>The language supports two types of conditions. First — this is the operation of condition for use within the expression, second — a global, based on the conditional operators.
</p><p>The condition inside an expression is based on the operations '?' and ':'. As an example we'll write the following practical expression:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre><span class="nx">st_open</span> <span class="o">=</span> <span class="p">(</span><span class="nx">pos</span> <span class="o">&gt;=</span> <span class="mi">100</span><span class="p">)</span> <span class="o">?</span> <span class="kc">true</span> <span class="o">:</span> <span class="kc">false</span><span class="p">;</span>
</pre></div>
<p>Which reads as — if the variable <i>pos</i> greater than or equal to <b>100</b>, the variable <i>st_open</i> is set to <b>true</b>, otherwise — to <b>false</b>.
</p><p>The global condition is based on the conditional operators "if" and "else". As an example, we can show the same expression, but recorded in another way:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre><span class="k">if</span><span class="p">(</span><span class="nx">pos</span> <span class="o">&gt;</span> <span class="mi">100</span><span class="p">)</span> <span class="nx">st_open</span> <span class="o">=</span> <span class="kc">true</span><span class="p">;</span> <span class="k">else</span> <span class="nx">st_open</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>
</pre></div>
<h4><span class="mw-headline" id="Loops"><span class="mw-headline-number">1.4.2</span> Loops</span></h4>
<p>Two types of the loops are supported: <b>while</b>, <b>for</b> and <b>for-in</b>. The syntax of the loops corresponds to the programming languages: C++, Java and JavaScript.
</p><p>Loop <b>while</b> is written generally as follows: <b>while({condition}) {body of the loop};</b><br />
Loop <b>for</b> is written as follows: <b>for({pre-initialization};{condition};{post-calculation}) {body of the loop};</b><br />
Loop <b>for-in</b> is written as follows: <b>for({variable} in {object}) {body of the loop};</b><br />
Where:
</p>
<dl><dd><i>{condition}</i> — expression, determining the condition;</dd>
<dd><i>{body of the loop}</i> — the body of the loop of multiple execution;</dd>
<dd><i>{pre-initialization}</i> — expression of pre-initialization of variables of the loop;</dd>
<dd><i>{post-calculation}</i> — expression of modification of parameters of the loop after next iteration;</dd>
<dd><i>{variable}</i> — variable, which will contain object's properties name at scan;</dd>
<dd><i>{object}</i> — object for which the properties are scanned.</dd></dl>
<h4><span class="mw-headline" id="Internal_functions"><span class="mw-headline-number">1.4.3</span> Internal functions</span></h4>
<p>The language supports definition and call of internal functions. To determine the internal function, the keyword "function" is used and in general, the definition has a syntax: <b>function {fName} ({var1}, {var2}, ... {varN}) { {the function body} }</b>. Defining an internal function inside another is not allowed but it is allowed to call a previously defined one.
</p><p>Calling an internal function is done in a typical way as a procedure <b>{fName}({var1}, {var2}, ... {varN});</b> or as a function <b>{vRez} = {fName}({var1}, {var2}, ... {varN});</b>. The call of internal functions is valid only after their declaration is higher!
</p><p>All defined variables into the main body inaccessible into the internal function and can be pass in as two way arguments of the internal function call or as the main function arguments. All defined variables into the internal function have itself namespace and inaccessible from the main body or any other internal function and can be pass out to the main body as two way arguments, return of the internal function call or the main function arguments. The internal function variables are registered for saving/restoring their context after second and more entry to the function, so they completely support the recursive calls!
</p><p>Operator "return" into the internal function makes controllable finishing of the function execution and places a pointed variable or an expression result as the internal function call result.
</p><p>An example of the internal function declaration and using in typical way shown next:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre><span class="kd">function</span> <span class="nx">sum</span><span class="p">(</span><span class="nx">a</span><span class="p">,</span> <span class="nx">b</span><span class="p">,</span> <span class="nx">c</span><span class="p">,</span> <span class="nx">d</span><span class="p">)</span> <span class="p">{</span> <span class="k">return</span> <span class="nx">a</span> <span class="o">+</span> <span class="p">((</span><span class="nx">b</span><span class="o">==</span><span class="kc">null</span><span class="p">)</span><span class="o">?</span><span class="mi">0</span><span class="o">:</span><span class="nx">b</span><span class="p">)</span> <span class="o">+</span> <span class="p">((</span><span class="nx">c</span><span class="o">==</span><span class="kc">null</span><span class="p">)</span><span class="o">?</span><span class="mi">0</span><span class="o">:</span><span class="nx">c</span><span class="p">)</span> <span class="o">+</span> <span class="p">((</span><span class="nx">d</span><span class="o">==</span><span class="kc">null</span><span class="p">)</span><span class="o">?</span><span class="mi">0</span><span class="o">:</span><span class="nx">d</span><span class="p">);</span> <span class="p">}</span>
<span class="nx">rez</span> <span class="o">=</span> <span class="nx">sum</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">);</span>
</pre></div>
<h4><span class="mw-headline" id="Special_characters_of_the_string_variables"><span class="mw-headline-number">1.4.4</span> Special characters of the string variables</span></h4>
<p>The language supports the following special characters of the string variables:
</p>
<dl><dd>"\n" — line feed;</dd>
<dd>"\t" — tabulation symbol;</dd>
<dd>"\b" — culling;</dd>
<dd>"\f" — page feed;</dd>
<dd>"\r" — carriage return;</dd>
<dd>"\\" — the character itself '\'.</dd>
<dd>"\041" — the '!' character, written in an octal number;</dd>
<dd>"\x21" — the '!' character, written in a hex number.</dd></dl>
<p><br />
</p>
<h2><span class="mw-headline" id="System-wide_user_objects"><span class="mw-headline-number">2</span> <span id="Object" title="#Object">System-wide user objects</span></span></h2>
<p>JavaLikeCalc provides support of the data type "Object". The data type "Object" is an associated container of properties and functions. The properties can support data of fourth basic types and other objects. Access to object properties can be done through the record of property names to the object <i>obj.prop</i>, through a dot, and also through the inclusion of the property name in square brackets <i>obj["prop"]</i>. It is obvious that the first mechanism is static, while the second lets you to specify the name of the property through a variable. The name of the property through the dot must not start with a digit and contain operations symbols; otherwise, for the first digit, the <a href="User_API.html" title="Special:MyLanguage/Documents/User API">object prefix</a> should be used — <b>SYS.BD.SQLite.db_1s</b>, or write in square brackets — <b>SYS.BD.SQLite["1+s"]</b>, for operations symbols in the name. Object's properties removing you can perform by the operator "delete". Reading of an undefined property will return <b>null</b>-<b>EVAL</b>. Creating an object is carried by the keyword <i>new</i>: <b>varO = new Object()</b>. The basic definition of the object does not contain functions. Copying of an object is actually makes the reference to the original object. When you delete an object is carried out the reducing of the reference count, and when the count is set to zero then the object is removed physically.
</p><p>Different components of OpenSCADA can define the basic object with special properties and functions. The standard extension of the object is an array "Array", which is created by the command <b>varO = new Array(prm1,prm2,prm3,...,prmN)</b>. Comma-separated parameters are placed in the array in the original order. If the parameter is the only one the array is initiated by the specified number of empty elements. Peculiarity of the array is that it works with the properties as the indexes and the main mechanism of addressing is placing the index into square brackets <i>arr[1]</i> is accessible. Array stores the properties in its own container of the one-dimensional array. Digital properties of the array are used to access directly to the array, and the characters work as the object properties. For more details about the properties and functions of the array can be read <a href="User_API.html#Array" title="Special:MyLanguage/Documents/User API">here</a>.
</p><p>The object of regular expression "RegExp" is created by command <b>varO = new RegExp(pat, flg)</b>, where <i>pat</i> — pattern of the regular expression, and <i>flg</i> — match flags. The object for work with regular expressions, based on the library "PCRE". In the global search set object attribute "lastIndex", which allows you to continue searching for the next function call. In the case of an unsuccessful search for the attribute "lastIndex" reset to zero. For more details about the properties and functions of the regular expression object can be read <a href="User_API.html#RegExp" title="Special:MyLanguage/Documents/User API">here</a>.
</p><p>For random access to the function arguments provided the arguments object, which you can refer to by the symbol "arguments". This object contains the property "length" with a number of arguments in the function and allows you to access to a value of the argument by its <b>number</b> or <b>ID</b>. Consider the enumeration of the arguments on the cycle:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre><span class="nx">args</span> <span class="o">=</span> <span class="k">new</span> <span class="nb">Array</span><span class="p">();</span>
<span class="k">for</span><span class="p">(</span><span class="kd">var</span> <span class="nx">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="nx">i</span> <span class="o">&lt;</span> <span class="nx">arguments</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span> <span class="nx">i</span><span class="o">++</span><span class="p">)</span>
  <span class="nx">args</span><span class="p">[</span><span class="nx">i</span><span class="p">]</span> <span class="o">=</span> <span class="nx">arguments</span><span class="p">[</span><span class="nx">i</span><span class="p">];</span>
</pre></div>
<p>The basic types have the partial properties of the object. Properties and functions of the basic types are listed below: 
</p>
<ul><li> NULL type, functions:
<ul><li> <i>bool isEVal();</i> — returns "true".</li></ul></li></ul>
<ul><li> Logical type, functions:
<ul><li> <i>bool isEVal(); bool isNaN( );</i> — checks the value to <b>null</b>-<b>EVAL</b>.</li>
<li> <i>string toString();</i> — performs the value as the string "true" or "false".</li></ul></li></ul>
<dl><dd><ul><li> <i>real toReal();</i> — reads this Boolean as a real number.</li>
<li> <i>int toInt();</i> — reads this Boolean as an integer number.</li></ul></dd></dl>
<ul><li> Integer and real number:</li></ul>
<dl><dd><dl><dt> <i>Properties:</i></dt></dl>
<ul><li> <i>MAX_VALUE</i> — maximum value; </li>
<li> <i>MIN_VALUE</i> — minimum value;</li>
<li> <i>NaN</i> —  error value.</li></ul>
<dl><dt> <i>Functions:</i></dt></dl>
<ul><li> <i>bool isEVal(); bool isNaN( );</i> — checks the value to <b>null</b>-<b>EVAL</b>, and NaN for Real.</li>
<li> <i>string toExponential( int numbs = -1 );</i> — returns the string of the number, formatted in the exponential notation, and with the number of significant digits <i>numbs</i>. If <i>numbs</i> is missing the number of digits will have as much as needed.</li>
<li> <i>string toFixed( int numbs = 0, int len = 0, bool sign = false );</i> — returns the string of the number, formatted in the notation of fixed-point, and with the number of significant digits after the decimal point <i>numbs</i>, for minimum length <i>len</i> and compulsion to the presence of a <i>sign</i>. If <i>numbs</i> is missing, the number of digits after the decimal point is equal to zero.</li>
<li> <i>string toPrecision( int prec = -1 );</i> — returns the string of the number, formatted with the number of significant digits <i>prec</i>.</li>
<li> <i>string toString( int base = 10, int len = -1, bool sign = false );</i> — returns the string of the number of the integer type, formatted with the following representation <i>base</i> (2-36), for minimum length <i>len</i> and compulsion to the presence of a <i>sign</i>.</li>
<li> <i>real toReal();</i> — reads this integer-real as a real number.</li>
<li> <i>int toInt();</i> — reads this integer-real as an integer number.</li></ul></dd></dl>
<ul><li> String: </li></ul>
<dl><dd><dl><dt> <i>Properties:</i></dt></dl>
<ul><li> <i>int length</i> — string length. </li></ul>
<dl><dt> <i>Functions:</i></dt></dl>
<ul><li> <i>bool isEVal();</i> — checks value to <b>null</b>-<b>EVAL</b>.</li>
<li> <i>bool isNaN( bool whole = true );</i> — checks the string to Not A Number and in whole for <i>whole</i>. </li>
<li> <i>string charAt( int symb, string type = "" );</i> — extracts from the string the symbol <i>symb</i> for the <i>type</i>. These types of the symbol are supported: ""-ASCII and raw one byte code, UTF-8, UTF-16, UTF-32. In the case of UTF-8, the symbol position <i>symb</i> is changed to the next symbol position due to length of this symbols type is variable one.</li>
<li> <i>int charCodeAt( int symb, string type = "" );</i> — extracts from the string the symbol code <i>symb</i> for the <i>type</i>. These types of the symbol are supported: ""-ASCII and raw one byte code, UTF-8, UTF-16, UTF-16LE, UTF-16BE, UTF-32, UTF-32LE, UTF-32BE. In the case of UTF-8, the symbol position <i>symb</i> is changed to the next symbol position due to length of this symbols type is variable one.</li>
<li> <i>string concat( string val1, string val2, ... );</i> — returns a new string formed by joining the values <i>val1</i> etc. to the original one.</li>
<li> <i>int indexOf( string substr, int start = 0 );</i> — returns the position of the required string <i>substr</i> in the original row from the position <i>start</i>. If the initial position is not specified then the search starts from the beginning. If the search string is not found then "-1" is returned.</li>
<li> <i>int lastIndexOf( string substr, int start = {end} );</i> — returns the position of the search string <i>substr</i> in the original one beginning from the position of <i>start</i> when searching from the end. If the initial position is not specified then the search begins from the end. If the search string is not found then "-1" is returned.</li>
<li> <i>int search( string pat, string flg = "" );</i> — searches into the string by the pattern <i>pat</i> and pattern's flags <i>flg</i>. Returns found substring position or "-1" for else.</li></ul></dd></dl>
<div class="mw-highlight mw-content-ltr" dir="ltr" style="margin-left: 30pt"><pre><span class="kd">var</span> <span class="nx">rez</span> <span class="o">=</span> <span class="s2">"Java123Script"</span><span class="p">.</span><span class="nx">search</span><span class="p">(</span><span class="s2">"script"</span><span class="p">,</span><span class="s2">"i"</span><span class="p">);</span>  <span class="c1">// rez = 7</span>
</pre></div>
<dl><dd><ul><li> <i>int search( RegExp pat );</i> — searches into the string by the "RegExp" pattern <i>pat</i>. Returns found substring position or "-1" for else.</li></ul></dd></dl>
<div class="mw-highlight mw-content-ltr" dir="ltr" style="margin-left: 30pt"><pre><span class="kd">var</span> <span class="nx">rez</span> <span class="o">=</span> <span class="s2">"Java123Script"</span><span class="p">.</span><span class="nx">search</span><span class="p">(</span><span class="k">new</span> <span class="nb">RegExp</span><span class="p">(</span><span class="s2">"script"</span><span class="p">,</span><span class="s2">"i"</span><span class="p">));</span>  <span class="c1">// rez = 7</span>
</pre></div>
<dl><dd><ul><li> <i>Array match( string pat, string flg = "" );</i> — calls match for the string by the pattern <i>pat</i> and flags <i>flg</i>. Returns matched substring (0) and subexpressions (&gt;0) array. Sets "index" attribute of the array to the substring position. Sets the "input" attribute to the source string. Sets the "err" attribute to the operation error code.</li></ul></dd></dl>
<div class="mw-highlight mw-content-ltr" dir="ltr" style="margin-left: 30pt"><pre><span class="kd">var</span> <span class="nx">rez</span> <span class="o">=</span> <span class="s2">"1 plus 2 plus 3"</span><span class="p">.</span><span class="nx">match</span><span class="p">(</span><span class="s2">"\\d+"</span><span class="p">,</span><span class="s2">"g"</span><span class="p">);</span>  <span class="c1">// rez = [1], [2], [3]</span>
</pre></div>
<dl><dd><ul><li> <i>Array match( TRegExp pat );</i> — calls match for the string and "RegExp" pattern <i>pat</i>. Returns matched substring (0) and subexpressions (&gt;0) array. Sets the "index" attribute of the array to substring position. Sets the "input" attribute to the source string. Sets the "err" attribute to the operation error code.</li></ul></dd></dl>
<div class="mw-highlight mw-content-ltr" dir="ltr" style="margin-left: 30pt"><pre><span class="kd">var</span> <span class="nx">rez</span> <span class="o">=</span> <span class="s2">"1 plus 2 plus 3"</span><span class="p">.</span><span class="nx">match</span><span class="p">(</span><span class="k">new</span> <span class="nb">RegExp</span><span class="p">(</span><span class="s2">"\\d+"</span><span class="p">,</span><span class="s2">"g"</span><span class="p">));</span>  <span class="c1">// rez = [1], [2], [3]</span>
</pre></div>
<dl><dd><ul><li> <i>string slice( int beg, int end ); string substring( int beg, int end );</i> — returns the string extracted from the original one starting from the <i>beg</i> position and ending before the <i>end</i> (not included), numbering from zero. If the begin or end is negative, then the count is conducted from the end of the line. If the end is not specified, then the end is the end of the line. For example, the construction <b>substring(-2)</b> return two last symbols of the string.</li>
<li> <i>Array split( string sep, int limit = 0 );</i> — returns the array of strings separated by <i>sep</i> with the <i>limit</i> of the number of elements (0 for no limit).</li>
<li> <i>Array split( RegExp pat, int limit = 0 );</i> — returns the array of strings separated by the RegExp pattern <i>pat</i> with the <i>limit</i> of the number of elements (0 for no limit).</li></ul></dd></dl>
<div class="mw-highlight mw-content-ltr" dir="ltr" style="margin-left: 30pt"><pre><span class="nx">rez</span> <span class="o">=</span> <span class="s2">"1,2, 3 , 4 ,5"</span><span class="p">.</span><span class="nx">split</span><span class="p">(</span><span class="k">new</span> <span class="nb">RegExp</span><span class="p">(</span><span class="s2">"\\s*,\\s*"</span><span class="p">));</span>  <span class="c1">// rez = [1], [2], [3], [4], [5]</span>
</pre></div>
<dl><dd><ul><li> <i>string insert( int pos, string substr );</i> — inserts the substring <i>substr</i> into this string's position <i>pos</i>.</li>
<li> <i>string replace( int pos, int n, string str );</i> — replaces substring into the position <i>pos</i> and length <i>n</i> to the string <i>str</i>.</li></ul></dd></dl>
<div class="mw-highlight mw-content-ltr" dir="ltr" style="margin-left: 30pt"><pre><span class="nx">rez</span> <span class="o">=</span> <span class="s2">"Javascript"</span><span class="p">.</span><span class="nx">replace</span><span class="p">(</span><span class="mi">4</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="s2">"67"</span><span class="p">);</span>  <span class="c1">// rez = "Java67ipt"</span>
</pre></div>
<dl><dd><ul><li> <i>string replace( string substr, string str );</i> — replaces all the substrings <i>substr</i> to the string <i>str</i>.</li></ul></dd></dl>
<div class="mw-highlight mw-content-ltr" dir="ltr" style="margin-left: 30pt"><pre><span class="nx">rez</span> <span class="o">=</span> <span class="s2">"123 321"</span><span class="p">.</span><span class="nx">replace</span><span class="p">(</span><span class="s2">"3"</span><span class="p">,</span><span class="s2">"55"</span><span class="p">);</span>  <span class="c1">// rez = "1255 5521"</span>
</pre></div>
<dl><dd><ul><li> <i>string replace( RegExp pat, string str );</i> — replaces substrings by the pattern <i>pat</i> to the string <i>str</i>.</li></ul></dd></dl>
<div class="mw-highlight mw-content-ltr" dir="ltr" style="margin-left: 30pt"><pre><span class="nx">rez</span> <span class="o">=</span> <span class="s2">"value = \"123\""</span><span class="p">.</span><span class="nx">replace</span><span class="p">(</span><span class="k">new</span> <span class="nb">RegExp</span><span class="p">(</span><span class="s2">"\"([^\"]*)\""</span><span class="p">,</span><span class="s2">"g"</span><span class="p">),</span><span class="s2">"``$1''"</span><span class="p">));</span>  <span class="c1">// rez = "value = ``123''"</span>
</pre></div>
<dl><dd><ul><li> <i>real toReal();</i> — converts this string to a real number.</li>
<li> <i>int toInt( int base = 0 );</i> — converts this string to an integer number in accordance with <i>base</i> (from 2 to 36). If the base is 0, then the prefix will be considered a prefix for determining the base (123-decimal; 0123-octal; 0x123-hex).</li>
<li> <i>string {parse,parseEnd}( int pos, string sep = ".", int off = {0,{length}}, bool mergeSepSymb = false );</i> — gets a token with the number <i>pos</i> from the string when separated by <i>sep</i> and from the offset <i>off</i> (stopping on the next token begin, end for <i>parseEnd</i>). <i>mergeSepSymb</i> specifies of allowing of merging of the group of identical symbols to one separator. Result offset is returned back to <i>off</i>. <i>parseEnd()</i> does the same but from the end.</li>
<li> <i>string parseLine( int pos, int off = 0 );</i> — gets a line with the number <i>pos</i> from the string and from the offset <i>off</i>. Result offset is returned back to <i>off</i> (stopping on the next token begin).</li>
<li> <i>string parsePath( int pos, int offCmptbl = 0, int off = 0 );</i> — gets a path token with the number <i>pos</i> from the string and from the offset <i>off</i> (stopping on the next token begin) or <i>offCmtbl</i> (stopping on next symbol of the current token end — for compatibility). Result offset is returned back to <i>off</i> or <i>offCmptbl</i>.</li>
<li> <i>string parsePathEnd( int pos, int off = {length} );</i> — gets a path token with the number <i>pos</i> from the string end and from the offset <i>off</i> (stopping on the next token end). Result offset is returned back to <i>off</i>.</li>
<li> <i>string path2sep( string sep = "." );</i> — converts path into this string to separated by <i>sep</i> string.</li>
<li> <i>string trim( string cfg = " \n\t\r" );</i> — trims the string at the begin and the end for the symbols <i>cfg</i>.</li></ul></dd></dl>
<p><br />
</p>
<h3><span class="mw-headline" id="Array_object"><span class="mw-headline-number">2.1</span> <span id="Array" title="#Array">Array object</span></span></h3>
<p>Peculiarity of the array is that it works with the properties like with the indexes, and complete their naming if senseless, and hence the mechanism of addressing is available only by the conclusion of the index in square brackets "<b>arr[1]</b>". Array stores the properties in its own container of one-dimensional array. Digital properties of the array are used to access directly to the array, and the character ones work as the object properties.
</p><p>Array provides the special property "length" to get the array size "<b>var = arr.length;</b>". Also array provides the following functions:
</p>
<ul><li> <i>string join( string sep = "," )</i>, <i>string toString( string sep = "," )</i>, <i>string valueOf( string sep = "," )</i> — returns the string with the array elements separated by <i>sep</i> or the character ','.</li>
<li> <i>Array concat( Array arr );</i> — adds to the initial array the elements of the <i>arr</i> array. Returns the initial array with changes.</li>
<li> <i>int push( ElTp var, ... );</i> — places the element(s) <i>var</i> to the end of the array, as to the stack. Returns the new array size.</li>
<li> <i>ElTp pop( );</i> — deletes of the last element of the array and returns of its value, as from the stack.</li>
<li> <i>Array reverse( );</i> — changes the order of the elements of the array. Returns the initial array with the changes.</li>
<li> <i>ElTp shift( );</i> — shifts of the array to the top. The first element is removed and its value is returned.</li>
<li> <i>int unshift( ElTp var, ... );</i> — shifts element(s) <i>var</i> to the array. The first element to the 0, second to the 1 and so on.</li>
<li> <i>Array slice( int beg, int end );</i> — returns an array fragment from <i>beg</i> to <i>end</i> (exclude). If the value of beginning or end is negative, then the count is made from the end of the array. If the end is not specified, then the end is the end of the array.</li>
<li> <i>Array splice( int beg, int remN, ElTp val1, ElTp val2, ... );</i> — inserts, deletes or replaces the elements of the array. Returns the removed elements array. Firstly it is made the removing of elements from the position <i>beg</i> and in the quantity of <i>remN</i>, and then the values <i>val1</i> are inserted and so on, beginning from the position <i>beg</i>.</li>
<li> <i>int indexOf( ElTp var, int start = 0 );</i> — returns the array index of the required variable <i>var</i> in the original row from the position <i>start</i>. If the initial position is not specified then the search starts from the beginning. If the search variable is not found then "-1" is returned.</li>
<li> <i>int lastIndexOf( ElTp var, int start = {end} );</i> — returns the array index of the required variable <i>var</i> in the original row from the position <i>start</i> when searching from the end. If the initial position is not specified then the search begins from the end. If the search variable is not found then "-1" is returned.</li>
<li> <i>double sum(int beg, int end);</i> — sum of the array values part from the position <i>beg</i> to <i>end</i>, excluding.</li>
<li> <i>Array sort( );</i> — sorts array elements in the lexicographical order.</li></ul>
<h3><span class="mw-headline" id="RegExp_object"><span class="mw-headline-number">2.2</span> <span id="RegExp" title="#RegExp">RegExp object</span></span></h3>
<p>Object of work with the regular expressions, based on the library PCRE. In the global search sets object attribute "lastIndex", which allows you to continue the searching at the next function call. In the case of an unsuccessful search the attribute "lastIndex" resets to zero.
</p><p>As arguments for creating the object, a string with regular expression text and a flags box in the form of a character string is passed:
</p>
<ul><li> 'g' — global match mode, that is meant the request repeating for processing all expressions up to empty result array;</li>
<li> 'i' — case insensitive match mode;</li>
<li> 'm' — multi-line match mode;</li>
<li> 'u' — compulsion for UTF-8 characters resolution, for other locales;</li>
<li> 'p' — testing the expression by the usual template rule with the key characters: '?', '*' and '\'.</li></ul>
<p>Object properties:
</p>
<ul><li> <i>source</i> — original pattern of the regular expression, read-only.</li>
<li> <i>global</i> — flag of the global matching, read-only.</li>
<li> <i>ignoreCase</i> — flag of disabling of the case sensitivity, read-only.</li>
<li> <i>multiline</i> — flag of the multiline searching, read-only.</li>
<li> <i>UTF8</i> — flag of using UTF-8 characters, read-only.</li>
<li> <i>lastIndex</i> — index of a character of the substring from the last search. Used in the global mode to continue the match, at next call.</li></ul>
<p>Object functions:
</p>
<ul>
<li><i>Array exec( string val );</i> — calls match for string <i>val</i>. Returns found sub-string (0) and sub-expressions (&gt;0) in the array. Sets attribute "index" of the array to the matched substring position. Sets the attribute "input" of the array to the source string.
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre><span class="kd">var</span> <span class="nx">re</span> <span class="o">=</span> <span class="k">new</span> <span class="nb">RegExp</span><span class="p">(</span><span class="s2">"(\\d\\d)[-/](\\d\\d)[-/](\\d\\d(?:\\d\\d)?)"</span><span class="p">,</span><span class="s2">""</span><span class="p">);</span>
<span class="kd">var</span> <span class="nx">rez</span> <span class="o">=</span> <span class="nx">re</span><span class="p">.</span><span class="nx">exec</span><span class="p">(</span><span class="s2">"12/30/1969"</span><span class="p">);</span>
<span class="kd">var</span> <span class="nx">month</span> <span class="o">=</span> <span class="nx">rez</span><span class="p">[</span><span class="mi">1</span><span class="p">];</span>
<span class="kd">var</span> <span class="nx">day</span> <span class="o">=</span> <span class="nx">rez</span><span class="p">[</span><span class="mi">2</span><span class="p">];</span>
<span class="kd">var</span> <span class="nx">year</span> <span class="o">=</span> <span class="nx">rez</span><span class="p">[</span><span class="mi">3</span><span class="p">];</span>
</pre></div></li>
<li><i>bool test( string val );</i> — returns "true" for the match sub-string in <i>val</i>.
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre><span class="kd">var</span> <span class="nx">re</span> <span class="o">=</span> <span class="k">new</span> <span class="nb">RegExp</span><span class="p">(</span><span class="s2">"(\\d\\d)[-/](\\d\\d)[-/](\\d\\d(?:\\d\\d)?)"</span><span class="p">,</span><span class="s2">""</span><span class="p">);</span>
<span class="kd">var</span> <span class="nx">OK</span> <span class="o">=</span> <span class="nx">re</span><span class="p">.</span><span class="nx">test</span><span class="p">(</span><span class="s2">"12/30/1969"</span><span class="p">);</span>
</pre></div></li>
</ul>
<h3><span class="mw-headline" id="XML_node-tag_object_.28XMLNodeObj.29"><span class="mw-headline-number">2.3</span> XML node-tag object (XMLNodeObj)</span></h3>
<p>Functions:
</p>
<ul><li> <i>string name( )</i> — the name of the node, XML-tag.</li>
<li> <i>string text( bool full = false )</i> — the text of the node, contents of the XML-tag. Set <i>full</i> for get the combined text of all included nodes.</li>
<li> <i>string attr( string id )</i> — the value of the node attribute <i>id</i>.</li>
<li> <i>XMLNodeObj setName( string vl )</i> — sets of the node name to <i>vl</i>. Returns the current node.</li>
<li> <i>XMLNodeObj setText( string vl )</i> — sets of the node text to <i>vl</i>. Returns the current node.</li>
<li> <i>XMLNodeObj setAttr( string id, string vl )</i> — sets the attribute <i>id</i> to the value <i>vl</i>. Returns the current node.</li>
<li> <i>XMLNodeObj clear( bool full = false )</i> — clears the node for the childs, removes the text and attributes for <i>full</i>.</li>
<li> <i>int childSize( )</i> — quantity of the included nodes.</li>
<li> <i>XMLNodeObj childAdd( ElTp no = XMLNodeObj ); XMLNodeObj childAdd( string no )</i> — addition of the object <i>no</i> as the included one. <i>no</i> may be the direct object-result of the function "SYS.XMLNode()", and the string with the name of a new tag. Returns the included node.</li>
<li> <i>XMLNodeObj childIns( int id, ElTp no = XMLNodeObj ); XMLNodeObj childIns( int id, string no )</i> — insert of the object <i>no</i> as the included one to the position <i>id</i>. <i>no</i> may be the direct object-result of the function "SYS.XMLNode()", and the string with the name of a new tag. Returns the embedded node.</li>
<li> <i>XMLNodeObj childDel( int id )</i> — deletes the included node from the position <i>id</i>. Returns current node.</li>
<li> <i>XMLNodeObj childGet( int id )</i> — gets the included node in the position <i>id</i>. Returns <b>0</b> at missing one.</li>
<li> <i>XMLNodeObj childGet( string name, int num = 0 )</i> — gets the included node with the tag <i>name</i> and the position number <i>num</i>. Returns <b>0</b> at missing one.</li>
<li> <i>XMLNodeObj parent( )</i> — gets the parent node. Returns <b>false</b> at missing one.</li>
<li> <i>string load( string str, bool file = false, int flg = 0, string cp = "UTF-8" )</i> — loads the XML from the string <i>str</i> or from the file with the path in <i>str</i> if the <i>file</i> equal "true", with the source encoding <i>cp</i>. Returns a string with error in the format "<b>{errCod}:{errText}</b>", which is "0" for successful loading. Where <i>flg</i> — loading flags:</li></ul>
<dl><dd><dl><dd>0x01 — full loading, with texts and comments blocks into special nodes;</dd>
<dd>0x02 — does not remove spaces from the begin and end of the tag text.</dd></dl></dd></dl>
<ul><li> <i>string save( int flg = 0, string path = "", string cp = "UTF-8" )</i> — saves the XML tree to the string or to the file <i>path</i> with the formatting flags <i>flg</i> and target encoding <i>cp</i>. Returns the XML text or the error code. The following formatting options <i>flg</i> are provided:</li></ul>
<dl><dd><dl><dd>0x01 — end line before the opening tag;</dd>
<dd>0x02 — end line after the opening tag;</dd>
<dd>0x04 — end line after the closing tag;</dd>
<dd>0x08 — end line after the text;</dd>
<dd>0x10 — end line after the instruction;</dd>
<dd>0x1E — end line after all ones;</dd>
<dd>0x20 — inserts the standard XML-header;</dd>
<dd>0x40 — inserts the standard XHTML-header;</dd>
<dd>0x80 — cleans the service tags: &lt;??&gt;, &lt;!-- --&gt;;</dd>
<dd>0x100 — does not encode the tag name;</dd>
<dd>0x200 — does not encode the attribute;</dd>
<dd>0x400 — shield the binary symbols [\x0-\x8\xB-\xC\x0E-\x1F] and wrong UTF-8.</dd></dl></dd></dl>
<ul><li> <i>XMLNodeObj getElementBy( string val, string attr = "id" )</i> — gets an element from the tree by the attribute <i>attr</i> in value <i>val</i>.</li>
<li> <i>TArrayObj&lt;XMLNodeObj&gt; getElementsBy( string tag, string attrVal = "", string attr = "id", int limit = 0, int from = 0 )</i> — gets an elements array from the tree by the <i>tag</i> (empty for all) and attribute <i>attr</i> in value <i>attrVal</i> (empty for pass), also starting the tag number <i>from</i> and limiting them number in <i>limit</i> (zero for no limit).</li></ul>
<h2><span class="mw-headline" id="Program-system_.28SYS.29"><span class="mw-headline-number">3</span> <span id="SYS" title="#SYS">Program-system (SYS)</span></span></h2>
<p>Object functions:
</p>
<ul>
<li><i>{string|int} system( string cmd, bool noPipe = false );</i> — calls the console commands <i>cmd</i> of the OS returning the result by the channel. If <i>noPipe</i> is set then the callback code is returned and program can be started in the background ("sleep 5 &amp;"). The function provides OpenSCADA with a wide range of capabilities by calling any system programs, utilities, and scripts, as well as by providing them with access to a huge amount of system data. For example the command "ls-l" returns the detailed content of the working directory.</li>
<li><i>int fileSize( string file );</i> — returns the <i>file</i> size.</li>
<li><i>string fileRead( string file, int off = 0, int sz = -1 );</i> — returns a string of part of the <i>file</i> for the offset <i>off</i> and the block size <i>sz</i>.</li>
<li><i>int fileWrite( string file, string str, bool append = false );</i> — writes the string <i>str</i> to the <i>file</i>, removes presented one, at <i>append</i>. Returns the wrote bytes count.</li>
<li><i>int fileRemove( string file );</i> — removes the <i>file</i>. Returns the removing result.</li>
<li><i>int message( string cat, int level, string mess );</i> — forms of the system message <i>mess</i> with the category <i>cat</i>, level <i>level</i> (-7...7). The negative value of the level forms the alarms.</li>
<li><i>int messDebug( string cat, string mess ); int messInfo( string cat, string mess ); int messNote( string cat, string mess ); int messWarning( string cat, string mess ); int messErr( string cat, string mess ); int messCrit( string cat, string mess ); int messAlert( string cat, string mess ); int messEmerg( string cat, string mess );</i> — forms of the system message <i>mess</i> with the category <i>cat</i> and the appropriate level by the name.</li>
<li><i>XMLNodeObj XMLNode( string name = "" );</i> — creates of the XML node object with the <i>name</i>.</li>
<li><i>string cntrReq( XMLNodeObj req, string stat = "" );</i> — sends a request <i>req</i> in XML view to the <a href="API.html#CntrNode" title="Special:MyLanguage/Documents/API">Control Interface</a> of the program. Returns a string with error in the format "<b>{errCod}:{errText}</b>", which is "0" for successful. A request is generally written in the form <b>&lt;get path="/OPath/%2felem" /&gt;</b> and with additional attributes specific to the particular request. If the station <i>stat</i> is specified into the request then the request will be sent to this external station. The address for the attribute "path" you can obtain into the OpenSCADA configurator, that is into the status line where the address appear at the mouse cursor point to a field of configuration or information. Some examples of common requests, more examples in <a href="API.html#CntrNode" title="Special:MyLanguage/Documents/API">description the Control Interface</a> and <a href="Libs_Service_procedures.html#releaseTests" title="Special:MyLanguage/Libs/Service procedures">releaseTests()</a>:
<ul>
 <li>Reading a value of the element (the user name "test"):
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre><span class="nx">req</span> <span class="o">=</span> <span class="nx">SYS</span><span class="p">.</span><span class="nx">XMLNode</span><span class="p">(</span><span class="s2">"get"</span><span class="p">).</span><span class="nx">setAttr</span><span class="p">(</span><span class="s2">"path"</span><span class="p">,</span><span class="s2">"/sub_Security/usr_test/%2fprm%2fDESCR"</span><span class="p">);</span>
<span class="nx">SYS</span><span class="p">.</span><span class="nx">cntrReq</span><span class="p">(</span><span class="nx">req</span><span class="p">);</span>
<span class="nx">idSt</span> <span class="o">=</span> <span class="nx">req</span><span class="p">.</span><span class="nx">text</span><span class="p">();</span>
</pre></div></li>
 <li>Writing a value to the element (the user name "test"):
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre><span class="nx">req</span> <span class="o">=</span> <span class="nx">SYS</span><span class="p">.</span><span class="nx">XMLNode</span><span class="p">(</span><span class="s2">"set"</span><span class="p">).</span><span class="nx">setAttr</span><span class="p">(</span><span class="s2">"path"</span><span class="p">,</span><span class="s2">"/sub_Security/usr_test/%2fprm%2fDESCR"</span><span class="p">).</span><span class="nx">setText</span><span class="p">(</span><span class="s2">"New test user name"</span><span class="p">);</span>
<span class="nx">SYS</span><span class="p">.</span><span class="nx">cntrReq</span><span class="p">(</span><span class="nx">req</span><span class="p">);</span>
</pre></div></li>
 <li>Adding a new node (the user "test"):
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre><span class="nx">req</span> <span class="o">=</span> <span class="nx">SYS</span><span class="p">.</span><span class="nx">XMLNode</span><span class="p">(</span><span class="s2">"add"</span><span class="p">).</span><span class="nx">setAttr</span><span class="p">(</span><span class="s2">"path"</span><span class="p">,</span><span class="s2">"/sub_Security/%2fbr%2fusr_"</span><span class="p">).</span><span class="nx">setText</span><span class="p">(</span><span class="s2">"test"</span><span class="p">);</span>
<span class="nx">SYS</span><span class="p">.</span><span class="nx">cntrReq</span><span class="p">(</span><span class="nx">req</span><span class="p">);</span>
</pre></div></li>
 <li>Deleting a node (the user "test"):
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre><span class="nx">req</span> <span class="o">=</span> <span class="nx">SYS</span><span class="p">.</span><span class="nx">XMLNode</span><span class="p">(</span><span class="s2">"del"</span><span class="p">).</span><span class="nx">setAttr</span><span class="p">(</span><span class="s2">"path"</span><span class="p">,</span><span class="s2">"/sub_Security/%2fbr%2fusr_"</span><span class="p">).</span><span class="nx">setText</span><span class="p">(</span><span class="s2">"test"</span><span class="p">);</span>
<span class="nx">SYS</span><span class="p">.</span><span class="nx">cntrReq</span><span class="p">(</span><span class="nx">req</span><span class="p">);</span>
</pre></div></li>
 <li>Saving the node changes to DB (the user "test"):
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre><span class="nx">req</span> <span class="o">=</span> <span class="nx">SYS</span><span class="p">.</span><span class="nx">XMLNode</span><span class="p">(</span><span class="s2">"save"</span><span class="p">).</span><span class="nx">setAttr</span><span class="p">(</span><span class="s2">"path"</span><span class="p">,</span><span class="s2">"/sub_Security/usr_test/%2fobj"</span><span class="p">);</span>
<span class="nx">SYS</span><span class="p">.</span><span class="nx">cntrReq</span><span class="p">(</span><span class="nx">req</span><span class="p">);</span>
</pre></div></li>
 <li>Loading the node from DB (the user "test"):
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre><span class="nx">req</span> <span class="o">=</span> <span class="nx">SYS</span><span class="p">.</span><span class="nx">XMLNode</span><span class="p">(</span><span class="s2">"load"</span><span class="p">).</span><span class="nx">setAttr</span><span class="p">(</span><span class="s2">"path"</span><span class="p">,</span><span class="s2">"/sub_Security/usr_test/%2fobj"</span><span class="p">);</span>
<span class="nx">SYS</span><span class="p">.</span><span class="nx">cntrReq</span><span class="p">(</span><span class="nx">req</span><span class="p">);</span>
</pre></div></li>
</ul></li>
<li><i>string lang(string full);</i> — returns the system language in two symbols and the full language in <i>full</i>.</li>
<li><i>int sleep( real tm, int ntm = 0 );</i> — puts the execution thread to sleep on the <i>tm</i> seconds (precised up to nanoseconds) and <i>ntm</i> nanoseconds. The sleeping time you can set up to STD_INTERF_TM (5 seconds).</li>
<li><i>int time( int usec );</i> — returns the absolute time in seconds from the epoch of 1/1/1970 and the microseconds part into <i>usec</i> if specified.</li>
<li><i>int utime( ); int mtime( );</i> — returns the absolute time in microseconds and milliseconds from the epoch of 1/1/1970.</li>
<li><i>int {localtime|gmtime}( int fullsec, int sec, int min, int hour, int mday, int month, int year, int wday, int yday, int isdst );</i> — returns the full date in seconds (sec), minutes (min), hours (hour), days of the month (mday), months (month), years (year), days in the week (wday), days in the year (yday) and sign of the summer time (isdst), based on the absolute time in seconds <i>fullsec</i> from the epoch 1/1/1970. <i>gmtime</i> returns time in GMT(UTC).</li>
<li><i>int {mktime|timegm}( int sec, int min, int hour, int mday, int month, int year, int wday, int yday, int isdst );</i> — forms the time since Epoch 1/1/1970 from separated seconds, minutes, hours, days, month etc. The values for separated time items can be set out from this typical range, which allows you to use this function during checking, and as a result, units of time will be fixed and rotated in the normal range. <i>timegm</i> runs in time at GMT(UTC).</li>
<li><i>string {strftime|strftimegm}( int sec, string form = "%Y-%m-%d&nbsp;%H:%M:%S" );</i> — converts an absolute time <i>sec</i> to the string of the desired format <i>form</i>. Record of the format corresponds to the POSIX-function <i>strftime</i>. <i>strftimegm</i> returns time into GMT(UTC).</li>
<li><i>int {strptime|strptimegm}( string str, string form = "%Y-%m-%d&nbsp;%H:%M:%S" );</i> — returns the time in seconds from the epoch of 1/1/1970, based on the string record of time <i>str</i>, in accordance with the specified template <i>form</i>. For example the template "%Y-%m-%d&nbsp;%H:%M:%S" corresponds with the time "2006-08-08 11:21:55". Description of the template format can be obtained from the documentation on POSIX-function <i>strptime</i>. <i>strptimegm</i> works into GMT(UTC) time.</li>
<li><i><span id="CRON" title="#CRON">int cron( string cronreq, int base = 0 );</span></i> — returns the time, planned in the format of the standard CRON, <i>cronreq</i>, beginning from the basic time <i>base</i> or current, if the basic is not specified. CRON is the standard form "* * * * *".
<dl><dt> Where items by the order</dt>
<dd /></dl>
<ul><li> minutes (0-59);</li>
<li> hours (0-23);</li>
<li> days (1-31);</li>
<li> month (1-12);</li>
<li> week day (0[Sunday]-6).</li></ul>
<dl><dt> Where the item variants</dt>
<dd /></dl>
<ul><li> "*" — any value;</li>
<li> "1,2,3" — list of the allowed values;</li>
<li> "1-5" — raw range of the allowed values;</li>
<li> "*/2" — divider to the all allowed values range.</li></ul>
<dl><dt> Examples</dt>
<dd /></dl>
<ul><li> "* * * * *" — each minute;</li>
<li> "10 23 * * *" — only at 23 hour and 10 minute for any day and month;</li>
<li> "*/2 * * * *" — for minutes: 0,2,4,...,56,58;</li>
<li> "* 2-4 * * *" — for any minutes in hours from 2 to 4(include).</li></ul>
</li>
<li><i>string time2str( real tm, bool inParts = true );</i> — Converts the time interval <i>tm</i> in seconds to human string like "1hour 23minutes 10s" at setting <i>inParts</i> or "1.5 hour" else.</li>
<li><i>string cpct2str( real cnt );</i> — Converts the capacity <i>cnt</i> in bytes to the human representing string.</li>
<li><i>string str2time( string val, bool inParts = true );</i> — Converts the human representing relative time <i>val</i> of the function <i>time2str()</i> to the time in seconds, with parsing parts at setting <i>inParts</i>.</li>
<li><i>string strFromCharCode( int char1, int char2, int char3, ... );</i> — creates a string from symbol codes <i>char1</i>, <i>char2</i> ... <i>charN</i>.</li>
<li><i>string strFromCharUTF([string type = "UTF-8",] int char1, int char2, int char3, ...);</i> — creates a string from UTF symbols <i>char1</i>, <i>char2</i> ... <i>charN</i>. These types of the symbol are supported: UTF-8, UTF-16, UTF-16LE, UTF-16BE, UTF-32, UTF-32LE, UTF-32BE.</li>
<li><i>string strCodeConv( string src, string fromCP, string toCP );</i> — transcodes the text <i>src</i> from the encoding <i>fromCP</i> to <i>toCP</i>. If the encoding is omitted (empty string), it is used the internal one.</li>
<li><i>string strEncode( string src, string tp = "Bin", string opt = "" );</i> — encodes the string <i>src</i> by the rule <i>tp</i> and the option <i>opt</i>. Allowed rules:
<dl><dd>"PathEl" — symbols <b>[/%]</b> to "%2f" and "%25", respectively;</dd>
<dd>"HttpURL" — symbols <b>[ \t%]</b> and "&gt; 0x80" to "%20", "%09", "%25" and etc.;</dd>
<dd>"HTML" — symbols of the HTML-entities <b>[&gt;&lt;"&amp;']</b> to "&amp;gt;", "&amp;lt;", "&amp;quot;" and etc.;</dd>
<dd>"JavaScript" — symbol '\n' shielding to "\\n";</dd>
<dd>"SQL" — shielding of the symbols <b>['"`\]</b> by appending '\' or doubling of the listed symbols into <i>opt</i>;</dd>
<dd>"Custom" — symbols into <i>opt</i> to the view "%NN";</dd>
<dd>"Base64" — same Base 64 binary encoding, into <i>opt</i> sets a line termination symbol(s) after 57 symbols;</dd>
<dd>"FormatPrint" — symbol '%' to "%%";</dd>
<dd>"OscdID" — almost all symbols like <b>[ /\&amp;(]</b> to '_';</dd>
<dd>"Bin" — ASCII bytes list ("XX XX XX XX ...") to the binary represent;</dd>
<dd>"Reverse" — reversion the sequence;</dd>
<dd>"ToLower" — symbols to the lower register;</dd>
<dd>"Limit" — limiting the string to the length into <i>opt</i>, counting UTF-8 variable length;</dd>
<dd>"ShieldSymb" — shielding symbols from <i>opt</i> (by default ['"`]) with the slash symbol "\" like to '\n', '\r', ..., '\0NNN';</dd>
<dd>"ShieldBin" — shielding all binary symbols [\x0-\x8\xB-\xC\x0E-\x1F] with the slash symbol "\".</dd></dl>
</li>
<li><i>string strDecode( string src, string tp = "Bin", string opt = "" );</i> — decodes the string <i>src</i> by the rule <i>tp</i> and the option <i>opt</i>. Allowed rules:
<dl><dd>"PathEl", "HttpURL", "Custom" — symbols like "%NN" to the binary represent;</dd>
<dd>"Base64" — same from Base 64;</dd>
<dd>"Bin" — the binary string to ASCII bytes ("XX XX XX XX ..   A.b.c.."), <i>opt</i> points to the separator or "&lt;text&gt;" for enable the offset to the left and the text part to the right;</dd>
<dd>"ShieldSymb" — shielded symbols like to '\n', '\r', ..., '\0NNN', '\xNN' to the binary represent.</dd></dl>
</li></ul>
<h2><span class="mw-headline" id="Any_object_.28TCntrNode.29_of_OpenSCADA_objects_tree_.28SYS..2A.29"><span class="mw-headline-number">4</span> <span id="TCntrNode" title="#TCntrNode">Any object (TCntrNode) of OpenSCADA objects tree (SYS.*)</span></span></h2>
<p>Object functions:
</p>
<ul><li> <i>PropTp property(string id, PropTp val = NULL);</i> — Returns of the object's property <i>id</i> for the group <i>grp</i> with setting its at <i>val</i> non NULL and EVAL. Where <i>val</i> in EVAL is clearing the property and NULL (no the argument) just sets nothing. You can <a href="#Object">access directly</a> the properties for the TCntrNode objects, of course at their absency in the Object Model.</li>
<li> <i>TArrayObj nodeList( string grp = "", string path = "" );</i> — Get child nodes full identifiers list for group <i>grp</i> and node from path <i>path</i>. If <i>grp</i> empty then return nodes for all groups. The full identifier is "{grp}{nID}".</li>
<li> <i>TCntrNodeObj nodeAt( string path, string sep="" );</i> — Attach to node <i>path</i> into OpenSCADA objects tree. If a separator set into <i>sep</i> then path process as separated string. For missing and invalid nodes the function will return "false" when a correct node in it conversion to BOOLEAN will return "true".</li>
<li> <i>TCntrNodeObj nodePrev( );</i> — Get previous, parent, node.</li>
<li> <i>string nodePath( string sep = "", bool from_root = true );</i> — Getting the path of the current node in the object tree OpenSCADA. One separator character is specified in <i>sep</i> to get the path through the separator, for example, "DAQ.ModBus.PLC1.P1.var", otherwise "/DAQ/ModBus/PLC1/P1/var". <i>from_root</i> indicates a need to form a path from the root, and without the Station ID.</li>
<li> <i>int messSys( int level, string mess )</i> — Formation of the system message <i>mess</i> with the <i>level</i> with the node path as a category and with the human readable path before the message.</li></ul>
<h2><span class="mw-headline" id="Subsystem_.22Security.22_.28SYS.Security.29"><span class="mw-headline-number">5</span> Subsystem "Security" (SYS.Security)</span></h2>
<p>Functions of the subsystem object (SYS.Security):
</p>
<ul><li> <i>int access( string user, int mode, string owner, string group, int perm )</i> — checking for access of the <i>user</i> to resource which owned by the <i>owner</i> and <i>group</i> and for the <i>perm</i> and <i>mode</i>:</li></ul>
<dl><dd><dl><dd><i>user</i> — user of the access checking;</dd>
<dd><i>mode</i> — access mode (4-R, 2-W, 1-X);</dd>
<dd><i>owner</i> — owner of the resource;</dd>
<dd><i>group</i> — group of the resource;</dd>
<dd><i>perm</i> — permition of the resource (RWXRWXRWX — 0777).</dd></dl></dd></dl>
<p>Functions of the object "User" (SYS.Security["usr_{User}"]):
</p>
<ul><li> <i>ElTp cfg( string nm )</i> — gets the value of the configuration field <i>nm</i> of the object.</li>
<li> <i>bool cfgSet( string nm, ElTp val )</i> [<span style="color:red">access to the appropriate subsystem</span>] — sets the configuration field <i>nm</i> of the object to the value <i>val</i>.</li>
<li> <i>bool auth( string pass )</i> — returns TRUE at successful authentication the user for <i>pass</i>.</li>
<li> <i>Array groups( )</i> — returns the groups list of the user.</li></ul>
<p>Functions of the object "Users group" (SYS.Security["grp_{Group}"]):
</p>
<ul><li> <i>ElTp cfg( string nm )</i> — gets the value of the configuration field <i>nm</i> of the object.</li>
<li> <i>bool cfgSet( string nm, ElTp val )</i> [<span style="color:red">access to the appropriate subsystem</span>] — sets the configuration field <i>nm</i> of the object to the value <i>val</i>.</li>
<li> <i>bool user( string nm )</i> — checks for the user <i>nm</i> presence into the group.</li></ul>
<h2><span class="mw-headline" id="Subsystem_.22DB.22_.28SYS.BD.29"><span class="mw-headline-number">6</span> <span id="SYS.BD" title="#SYS.BD">Subsystem "DB" (SYS.BD)</span></span></h2>
<p>Functions of the database object (SYS.BD["TypeDB"]["DB"]):
</p>
<ul>
<li><i>ElTp cfg( string nm )</i> — gets the value of the configuration field <i>nm</i> of the object.</li>
<li><i>bool cfgSet( string nm, ElTp val )</i> [<span style="color:red">access to the appropriate subsystem</span>] — sets the configuration field <i>nm</i> of the object to the value <i>val</i>.</li>
<li><i>Array SQLReq( string req, bool tr = EVAL );</i> — performs the SQL-request <i>req</i> to the DB, inside (<i>tr</i>=true), outside (<i>tr</i>=false) or no matter (<i>tr</i>=EVAL) to the transaction. Returns an array of rows of the result table with the fields both per indexes and column names. At an error the result property "err" sets to the error value.
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre><span class="nx">DBTbl</span> <span class="o">=</span> <span class="nx">SYS</span><span class="p">.</span><span class="nx">BD</span><span class="p">.</span><span class="nx">MySQL</span><span class="p">.</span><span class="nx">GenDB</span><span class="p">.</span><span class="nx">SQLReq</span><span class="p">(</span><span class="s2">"SELECT * from DB;"</span><span class="p">);</span>
<span class="k">if</span><span class="p">(</span><span class="nx">DBTbl</span><span class="p">.</span><span class="nx">err</span><span class="p">.</span><span class="nx">length</span><span class="p">)</span> <span class="nx">SYS</span><span class="p">.</span><span class="nx">messInfo</span><span class="p">(</span><span class="s2">"TEST DB"</span><span class="p">,</span><span class="s2">"Error: "</span><span class="o">+</span><span class="nx">DBTbl</span><span class="p">.</span><span class="nx">err</span><span class="p">);</span>
<span class="k">else</span> <span class="k">for</span><span class="p">(</span><span class="kd">var</span> <span class="nx">iRw</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="nx">iRw</span> <span class="o">&lt;</span> <span class="nx">DBTbl</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span> <span class="nx">iRw</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
  <span class="kd">var</span> <span class="nx">rec</span> <span class="o">=</span> <span class="s2">""</span><span class="p">;</span>
  <span class="k">for</span><span class="p">(</span><span class="kd">var</span> <span class="nx">iFld</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="nx">iFld</span> <span class="o">&lt;</span> <span class="nx">DBTbl</span><span class="p">[</span><span class="nx">iRw</span><span class="p">].</span><span class="nx">length</span><span class="p">;</span> <span class="nx">iFld</span><span class="o">++</span><span class="p">)</span> <span class="nx">rec</span> <span class="o">+=</span> <span class="nx">DBTbl</span><span class="p">[</span><span class="nx">iRw</span><span class="p">][</span><span class="nx">iFld</span><span class="p">]</span> <span class="o">+</span> <span class="s2">"\t"</span><span class="p">;</span>
  <span class="nx">SYS</span><span class="p">.</span><span class="nx">messInfo</span><span class="p">(</span><span class="s2">"TEST DB"</span><span class="p">,</span> <span class="s2">"Row "</span><span class="o">+</span><span class="nx">iRw</span><span class="o">+</span><span class="s2">": "</span><span class="o">+</span><span class="nx">rec</span><span class="p">);</span>
  <span class="c1">//Get column value by the name</span>
  <span class="k">if</span><span class="p">(</span><span class="nx">iRw</span><span class="p">)</span> <span class="nx">SYS</span><span class="p">.</span><span class="nx">messInfo</span><span class="p">(</span><span class="s2">"TEST DB"</span><span class="p">,</span> <span class="s2">"Row "</span><span class="o">+</span><span class="nx">iRw</span><span class="o">+</span><span class="s2">": 'NAME'"</span><span class="o">+</span><span class="nx">DBTbl</span><span class="p">[</span><span class="nx">iRw</span><span class="p">][</span><span class="s2">"NAME"</span><span class="p">]);</span>
<span class="p">}</span>
</pre></div></li>
</ul>
<p>Functions of the table object (SYS.BD["TypeDB"]["DB"]["Table"]):
</p>
<ul>
<li><i>XMLNodeObj fieldStruct( );</i> — gets the table structure in XML-node "field" with the child node-columns "<b>&lt;RowId type="real" len="10.2" key="1" def="Default value"&gt;{Value}&lt;/RowId&gt;</b>", where:<ul>
<li>{RowId} — column identifier;</li>
<li>{Value} — column value;</li>
<li>type — value type of the column: <i>str</i> — string, <i>int</i> — integer, <i>real</i> — real and <i>bool</i> — boolean;</li>
<li>len — value length of the column, in chars;</li>
<li>key — a sign that the column is the key, and the search is carried out according to its meaning;</li>
<li>def — default value of the column.</li>
</ul></li>
<li><i>string fieldSeek( int row, XMLNodeObj fld );</i> — seeks the field <i>row</i> of the table. For success returned "1" else "0". In case of error, returns "0: Error".</li>
<li><i>string fieldGet( XMLNodeObj fld );</i> — requests the field value. In case of error, returns "0: Error".
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre><span class="nx">req</span> <span class="o">=</span> <span class="nx">SYS</span><span class="p">.</span><span class="nx">XMLNode</span><span class="p">(</span><span class="s2">"field"</span><span class="p">);</span>
<span class="nx">req</span><span class="p">.</span><span class="nx">childAdd</span><span class="p">(</span><span class="s2">"user"</span><span class="p">).</span><span class="nx">setAttr</span><span class="p">(</span><span class="s2">"type"</span><span class="p">,</span><span class="s2">"str"</span><span class="p">).</span><span class="nx">setAttr</span><span class="p">(</span><span class="s2">"key"</span><span class="p">,</span><span class="s2">"1"</span><span class="p">).</span><span class="nx">setText</span><span class="p">(</span><span class="s2">"root"</span><span class="p">);</span>
<span class="nx">req</span><span class="p">.</span><span class="nx">childAdd</span><span class="p">(</span><span class="s2">"id"</span><span class="p">).</span><span class="nx">setAttr</span><span class="p">(</span><span class="s2">"type"</span><span class="p">,</span><span class="s2">"str"</span><span class="p">).</span><span class="nx">setAttr</span><span class="p">(</span><span class="s2">"key"</span><span class="p">,</span><span class="s2">"1"</span><span class="p">).</span><span class="nx">setText</span><span class="p">(</span><span class="s2">"/Lang2CodeBase"</span><span class="p">);</span>
<span class="nx">req</span><span class="p">.</span><span class="nx">childAdd</span><span class="p">(</span><span class="s2">"val"</span><span class="p">).</span><span class="nx">setAttr</span><span class="p">(</span><span class="s2">"type"</span><span class="p">,</span><span class="s2">"str"</span><span class="p">);</span>
<span class="nx">SYS</span><span class="p">.</span><span class="nx">BD</span><span class="p">.</span><span class="nx">MySQL</span><span class="p">.</span><span class="nx">GenDB</span><span class="p">.</span><span class="nx">SYS</span><span class="p">.</span><span class="nx">fieldGet</span><span class="p">(</span><span class="nx">req</span><span class="p">);</span>
<span class="nx">SYS</span><span class="p">.</span><span class="nx">messDebug</span><span class="p">(</span><span class="s2">"TEST DB"</span><span class="p">,</span><span class="s2">"Value: "</span><span class="o">+</span><span class="nx">req</span><span class="p">.</span><span class="nx">childGet</span><span class="p">(</span><span class="mi">2</span><span class="p">).</span><span class="nx">text</span><span class="p">());</span>
</pre></div></li>
<li><i>string fieldSet( XMLNodeObj fld );</i> — sets the field. In case of error, returns "0: Error".</li>
<li><i>string fieldDel( XMLNodeObj fld );</i> — removes the field. In case of error, returns "0: Error".</li>
</ul>
<h2><span class="mw-headline" id="Subsystem_.22DAQ.22_.28SYS.DAQ.29"><span class="mw-headline-number">7</span> <span id="SYS.DAQ" title="#SYS.DAQ">Subsystem "DAQ" (SYS.DAQ)</span></span></h2>
<p>Functions of the subsystem object (SYS.DAQ):
</p>
<ul>
<li><i>TCntrNodeObj daqAt(string path, string sep = "", waitForAttr = true)</i> — attaches to a DAQ node (controller object, parameter, attribute) in the <i>path</i> or the separated string by the separator <i>sep</i>, from the DAQ-subsystem. Check for an attribute in the path last element, at <i>waitForAttr</i>.</li>
<li><i>bool funcCall(string progLang, TVarObj args, string prog, string fixId = "", string err = "");</i> — executes the function text <i>prog</i> with the arguments <i>args</i> on the program language <i>progLang</i> and with the function fixing identifier <i>fixId</i> (automatic if it is empty). Returns "true" when it is executed correctly or "false" and set <i>err</i>. The fixed function differ from the automatic one by it does not remove after execution and uses repeatedly by an address into <i>fixId</i>, which replaces that original identifier in first call. To recreate the function, you must change the program or clear the <i>fixId</i> in its original id.
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre><span class="kd">var</span> <span class="nx">args</span> <span class="o">=</span> <span class="k">new</span> <span class="nb">Object</span><span class="p">();</span>
<span class="nx">args</span><span class="p">.</span><span class="nx">y</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
<span class="nx">args</span><span class="p">.</span><span class="nx">x</span> <span class="o">=</span> <span class="mi">123</span><span class="p">;</span>
<span class="nx">SYS</span><span class="p">.</span><span class="nx">DAQ</span><span class="p">.</span><span class="nx">funcCall</span><span class="p">(</span><span class="s2">"JavaLikeCalc.JavaScript"</span><span class="p">,</span><span class="nx">args</span><span class="p">,</span><span class="s2">"y=2*x;"</span><span class="p">);</span>
<span class="nx">SYS</span><span class="p">.</span><span class="nx">messDebug</span><span class="p">(</span><span class="s2">"TEST Calc"</span><span class="p">,</span><span class="s2">"TEST Calc rezult: "</span><span class="o">+</span><span class="nx">args</span><span class="p">.</span><span class="nx">y</span><span class="p">);</span>
</pre></div></li>
<li><i>string funcSnthHgl(string progLang);</i> — requesting the program language <i>progLang</i> syntax highlight rules in <a href="API.html#SnthHgl" title="Special:MyLanguage/Documents/API">the XML-tag <i>SnthHgl</i></a>.</li>
</ul>
<p>Functions of the controller object (SYS.DAQ["Modul"]["Controller"]):
</p>
<ul><li> <i>ElTp cfg( string nm )</i> — gets the value of the configuration field <i>nm</i> of the object.</li>
<li> <i>bool cfgSet( string nm, ElTp val )</i> [<span style="color:red">access to the appropriate subsystem</span>] — sets the configuration field <i>nm</i> of the object to the value <i>val</i>.</li>
<li> <i>string name( )</i> — name of the controller object.</li>
<li> <i>string descr( )</i> — description of the controller object and controller.</li>
<li> <i>string status( )</i> — status of the controller.</li>
<li> <i>bool messSet( string mess, int lev, string type2Code = "OP", string prm = "", string cat = "")</i> — sets of the DAQ-sourced message <i>mess</i> with the level <i>lev</i>, for the parameter <i>prm</i> (<b>{PrmId}</b>), additional category information <i>cat</i> and the type code <i>type2Code</i>. This function <a href="Program_manual.html#ArchMess" title="Special:MyLanguage/Documents/Program manual">forms the messages</a> with the unified DAQ-transparency category <b>{type2Code}{ModId}:{CntrId}[.{PrmId}][:{cat}]</b>, where:
<ul><li> <i>type2Code</i> — the message type two-symbol code, by default means the operator actions "OP";</li>
<li> <i>ModId</i> — identifier of the module;</li>
<li> <i>CntrId</i> — identifier of the controller object;</li>
<li> <i>PrmId</i> — parameter identifier, from the argument <i>prm</i>;</li>
<li> <i>cat</i> — additional category information which specific for the type <i>type2Code</i>.</li></ul></li>
<li> <i>bool alarmSet( string mess, int lev = -5, string prm = "", bool force = false )</i> — sets/removes of the violation <i>mess</i> with the level <i>lev</i> (negative to set otherwise to remove), for the parameter <i>prm</i> (<b>{PrmId}\n{PrmNm}</b>). The alarms clearance, as the setting also, works in the toggling mode, so means of passing the clearance messages to the message buffer, and the same clearance, only at the according violations presence, what may be disabled setting <i>force</i>. The function forms the alarms with the category <b>al{ModId}:{CntrId}[.{PrmId}]</b> and the text <b>{CntrNm} &gt; {PrmNm}: {MessText}</b>, where:
<ul><li> <i>ModId</i> — identifier of the module;</li>
<li> <i>CntrId</i> — identifier of the controller object;</li>
<li> <i>PrmId</i> — parameter identifier, from the argument <i>prm</i>;</li>
<li> <i>CntrNm</i> — name of the controller object;</li>
<li> <i>PrmNm</i> — parameter name, from the argument <i>prm</i>;</li>
<li> <i>MessText</i> — message text.</li></ul></li>
<li> <i>bool enable( bool newSt = EVAL )</i> — gets the status "Enabled" or changes it by the argument <i>newSt</i> assign.</li>
<li> <i>bool start( bool newSt = EVAL )</i> — gets the status "Running" or changes it by the argument <i>newSt</i> assign.</li></ul>
<p>Functions of the parameter object of the controller (SYS.DAQ["Modul"]["Controller"]["Parameter"]):
</p>
<ul><li> <i>ElTp cfg( string nm )</i> — gets the value of the configuration field <i>nm</i> of the object.</li>
<li> <i>bool cfgSet( string nm, ElTp val )</i> [<span style="color:red">access to the appropriate subsystem</span>] — sets the configuration field <i>nm</i> of the object to the value <i>val</i>.</li>
<li> <i>TCntrNodeObj cntr( )</i> — returns the controller object regardless of the nesting parameters.</li>
<li> <i>bool messSet( string mess, int lev, string type2Code = "OP", string cat = "")</i> — sets of the DAQ-sourced message <i>mess</i> with the level <i>lev</i>, for the parameter.</li>
<li> <i>bool alarmSet( string mess, int lev = -5, bool force = false )</i> — sets/removes of the violation <i>mess</i> with the level <i>lev</i> (negative to set otherwise to remove) for the parameter. The alarms clearance, as the setting also, works in the toggling mode, so means of passing the clearance messages to the message buffer, and the same clearance, only at the according violations presence, what may be disabled setting <i>force</i>.</li></ul>
<p>Functions of the attribute object of the parameter of the controller (SYS.DAQ["Modul"]["Controller"]["Parameter"]["Attribute"]):
</p>
<ul><li> <i>ElTp get( int tm = 0, int utm = 0, bool sys = false );</i> — gets the attribute value at the time <i>tm.utm</i> and system access flag <i>sys</i>. The time attributes <i>tm.utm</i> is outputs also then real time of the gotten value also places here if their are variables.</li>
<li> <i>bool set( ElTp val, int tm = 0, int utm = 0, bool sys = false );</i> — writes the value <i>val</i> to the attribute with the time label <i>tm.utm</i> and system access flag <i>sys</i>.</li>
<li> <i>TCntrNodeObj arch( );</i> — gets the archive associated with this attribute. Returns "false" in the case of absence the associated archive.</li>
<li> <i>string descr( );</i> — description of the attribute.</li>
<li> <i>int time( int utm );</i> — time of the last value of the attribute in seconds and microseconds into <i>utm</i>, if it is pointed and is a variable.</li>
<li> <i>int len( );</i> — length of the field in DB.</li>
<li> <i>int dec( );</i> — float resolution of the field in DB.</li>
<li> <i>int flg( );</i> — flags of the field.</li>
<li> <i>string def( );</i> — default value.</li>
<li> <i>string values( );</i> — allowed values list or range.</li>
<li> <i>string selNames( );</i> — names list of the allowed values.</li>
<li> <i>string reserve( );</i> — reserve string property of the value.</li></ul>
<p>Functions of object of templates library (SYS.DAQ[tmplb_Lib"]) and template (SYS.DAQ[tmplb_Lib"]["Tmpl"]) of controller's parameter:
</p>
<ul><li> <i>ElTp cfg( string nm )</i> — gets the value of the configuration field <i>nm</i> of the object.</li>
<li> <i>bool cfgSet( string nm, ElTp val )</i> [<span style="color:red">access to the appropriate subsystem</span>] — sets the configuration field <i>nm</i> of the object to the value <i>val</i>.</li></ul>
<h3><span class="mw-headline" id="Module_DAQ.JavaLikeCalc"><span class="mw-headline-number">7.1</span> Module <a href="Modules/JavaLikeCalc.html" title="Special:MyLanguage/Modules/JavaLikeCalc">DAQ.JavaLikeCalc</a></span></h3>
<div class="floatright"><a class="image" href="http://oscada.org/wiki/File:Oscada_UserOM_JavaLikeCalc.png" title="User object model of the module JavaLikeCalc."><img alt="User object model of the module JavaLikeCalc." height="214" src="files/Oscada_UserOM_JavaLikeCalc.png" width="223" /></a></div>
<p><b>The object "Functions library" (SYS.DAQ.JavaLikeCalc["lib_Lfunc"])</b>
</p>
<ul><li> <i>ElTp {funcID}(ElTp prm1, ...)</i> — calls the function "funcID" of the library "Lfunc" with the parameters <i>prm{N}</i>. Returns result of the called function. The prefix "lib_" before the library identifier is required!</li></ul>
<p><b>The object "User function" ( SYS.DAQ.JavaLikeCalc["lib_Lfunc"]["func"] )</b>
</p>
<ul><li> <i>ElTp call(ElTp prm1, ...)</i> — calls the function "func" of the library "Lfunc" with the parameters <i>prm{N}</i>. Returns result of the called function. The prefix "lib_" before the library identifier is required!</li></ul>
<h3><span class="mw-headline" id="Module_DAQ.LogicLev"><span class="mw-headline-number">7.2</span> Module <a href="Modules/LogicLev.html" title="Special:MyLanguage/Modules/LogicLev">DAQ.LogicLev</a></span></h3>
<p><b>The object "Parameter" [this]</b>
</p>
<ul><li> <i>bool attrAdd( string id, string name, string tp = "real", string selValsNms = "" )</i> [<span style="color: red">for enabled parameter of the logical type</span>] — adds the attribute <i>id</i> with the name <i>name</i> and the type <i>tp</i>. If the attribute is already present, the properties will be applied that can be changed on the go: name, selection mode and selection options.
<ul><li> <i>id, name</i> — identifier and name of the new attribute;</li>
<li> <i>tp</i> — attribute type [boolean | integer | real | string | text | object] + selection mode [sel | seled] + read-only [ro];</li>
<li> <i>selValsNms</i> — two lines with values in first and their names in second, separated by ";".</li></ul></li>
<li> <i>bool attrDel( string id )</i> [<span style="color: red">for enabled parameter of the logical type</span>] — removes the attribute <i>id</i>.</li></ul>
<h3><span class="mw-headline" id="Module_DAQ.BlockCalc"><span class="mw-headline-number">7.3</span> Module <a href="Modules/BlockCalc.html" title="Special:MyLanguage/Modules/BlockCalc">DAQ.BlockCalc</a></span></h3>
<div class="floatright"><a class="image" href="http://oscada.org/wiki/File:Oscada_UserOM_BlockCalc.png" title="User object model of the module BlockCalc."><img alt="User object model of the module BlockCalc." height="214" src="files/Oscada_UserOM_BlockCalc.png" width="218" /></a></div>
<p><b>The object "Block" (SYS.DAQ.BlockCalc["cntr"]["blk_block"])</b>
</p>
<ul><li> <i>ElTp cfg( string nm )</i> — get value of configuration field <i>nm</i> of the object.</li>
<li> <i>bool cfgSet( string nm, ElTp val )</i> [<span style="color:red">access to the appropriate subsystem</span>] — set configuration field <i>nm</i> of the object to value <i>val</i>.</li>
<li> <i>TCntrNodeObj cntr( )</i> — return the object of controller for the parameter nesting independent.</li></ul>
<h3><span class="mw-headline" id="Module_DAQ.ModBus"><span class="mw-headline-number">7.4</span> Module <a href="Modules/ModBus.html" title="Special:MyLanguage/Modules/ModBus">DAQ.ModBus</a></span></h3>
<div class="floatright"><a class="image" href="http://oscada.org/wiki/File:Oscada_UserOM_ModBus.png" title="User object model of the module ModBus."><img alt="User object model of the module ModBus." height="215" src="files/Oscada_UserOM_ModBus.png" width="323" /></a></div>
<p><b>The object "Controller" [this.cntr()]</b>
</p>
<ul><li> <i>string messIO(string pdu)</i> — sends <i>pdu</i> through the transport of the controller object by means of the ModBus protocol. PDU query result is placed instead of the query <i>pdu</i>, and the error returned by the function.</li></ul>
<p><b>The object "Parameter" [this]</b>
</p>
<ul><li> <i>bool attrAdd( string id, string name, string tp = "real", string selValsNms = "" )</i> [<span style="color: red">for enabled parameter of the logical type</span>] — adds the attribute <i>id</i> with the name <i>name</i> and the type <i>tp</i>. If the attribute is already present, the properties will be applied that can be changed on the go: name, selection mode and selection options.
<ul><li> <i>id, name</i> — identifier and name of the new attribute;</li>
<li> <i>tp</i> — attribute type [boolean | integer | real | string | text | object] + selection mode [sel | seled] + read-only [ro];</li>
<li> <i>selValsNms</i> — two lines with values in first and their names in second, separated by ";".</li></ul></li>
<li> <i>bool attrDel( string id )</i> [<span style="color: red">for enabled parameter of the logical type</span>] — removes the attribute <i>id</i>.</li></ul>
<h3><span class="mw-headline" id="Module_DAQ.Siemens"><span class="mw-headline-number">7.5</span> Module <a href="Modules/Siemens.html" title="Special:MyLanguage/Modules/Siemens">DAQ.Siemens</a></span></h3>
<p><b>The object "Parameter" [this]</b>
</p>
<ul><li> <i>bool attrAdd( string id, string name, string tp = "real", string selValsNms = "" )</i> [<span style="color: red">for enabled parameter of the logical type</span>] — adds the attribute <i>id</i> with the name <i>name</i> and the type <i>tp</i>. If the attribute is already present, the properties will be applied that can be changed on the go: name, selection mode and selection options.
<ul><li> <i>id, name</i> — identifier and name of the new attribute;</li>
<li> <i>tp</i> — attribute type [boolean | integer | real | string | text | object] + selection mode [sel | seled] + read-only [ro];</li>
<li> <i>selValsNms</i> — two lines with values in first and their names in second, separated by ";".</li></ul></li>
<li> <i>bool attrDel( string id )</i> [<span style="color: red">for enabled parameter of the logical type</span>] — removes the attribute <i>id</i>.</li></ul>
<h3><span class="mw-headline" id="Module_DAQ.OPC_UA"><span class="mw-headline-number">7.6</span> Module <a href="Modules/OPC_UA.html" title="Special:MyLanguage/Modules/OPC UA">DAQ.OPC_UA</a></span></h3>
<p><b>The object "Parameter" [this]</b>
</p>
<ul><li> <i>bool attrAdd( string id, string name, string tp = "real", string selValsNms = "" )</i> [<span style="color: red">for enabled parameter of the logical type</span>] — adds the attribute <i>id</i> with the name <i>name</i> and the type <i>tp</i>. If the attribute is already present, the properties will be applied that can be changed on the go: name, selection mode and selection options.
<ul><li> <i>id, name</i> — identifier and name of the new attribute;</li>
<li> <i>tp</i> — attribute type [boolean | integer | real | string | text | object] + selection mode [sel | seled] + read-only [ro];</li>
<li> <i>selValsNms</i> — two lines with values in first and their names in second, separated by ";".</li></ul></li>
<li> <i>bool attrDel( string id )</i> [<span style="color: red">for enabled parameter of the logical type</span>] — removes the attribute <i>id</i>.</li></ul>
<p><br />
</p>
<h2><span class="mw-headline" id="Subsystem_.22Archives-History.22_.28SYS.Archive.29"><span class="mw-headline-number">8</span> <span id="SYS.Archive" title="#SYS.Archive">Subsystem "Archives-History" (SYS.Archive)</span></span></h2>
<p>Functions of the subsystem object:
</p>
<ul><li> <i>Array messGet( int btm, int etm, string cat = "", int lev = 0, string arch = "", int upTm = 0 );</i> — requests of the program messages or alarms for the time from <i>btm</i> to <i>etm</i> for the category <i>cat</i>, level <i>lev</i> (-7...7) and archivers <i>arch</i> (separated by the symbol ';'; "" — buffer and archivers; "&lt;buffer&gt;" — buffer; "{ArhMod}.{Arh}" — concrete archiver of the module). <i>upTm</i> sets the operation continuance limit to time; a negative value used as relative time; less to STD_INTERF_TM (5). Returns time of stopping of the reading (attribute "tm" of the array) and an array of the message objects with the preset attributes:
<ul><li> <i>tm</i> — time of the message, seconds;</li>
<li> <i>utm</i> — time of the message, microseconds;</li>
<li> <i>categ</i> — category of the message;</li>
<li> <i>level</i> — level of the message;</li>
<li> <i>mess</i> — text of the message.</li></ul></li>
<li> <i>bool messPut( int tm, int utm, string cat, int lev, string mess, string arch = "" );</i> — writes the message <i>mess</i> with the category <i>cat</i>, level <i>lev</i> (-7...7) and time <i>tm.utm</i> to the archivers <i>arch</i> (separated by the symbol ';') or/and the alarms list.</li></ul>
<p>Functions of object's archiver of messages (SYS.Archive["mod_Modul"]["mess_Archivator"]):
</p>
<ul><li> <i>ElTp cfg( string nm )</i> — gets the value of the configuration field <i>nm</i> of the object.</li>
<li> <i>bool cfgSet( string nm, ElTp val )</i> [<span style="color:red">access to the appropriate subsystem</span>] — sets the configuration field <i>nm</i> of the object to the value <i>val</i>.</li>
<li> <i>bool status( )</i> — status "Running" of the archiver.</li>
<li> <i>int end( )</i> — end time of data of the archiver.</li>
<li> <i>int begin( )</i> — begin time of data of the archiver.</li></ul>
<p>Functions of object's archiver of values (SYS.Archive["val_Modul"]["val_Archivator"]):
</p>
<ul><li> <i>ElTp cfg( string nm )</i> — gets the value of the configuration field <i>nm</i> of the object.</li>
<li> <i>bool cfgSet( string nm, ElTp val )</i> [<span style="color:red">access to the appropriate subsystem</span>] — sets the configuration field <i>nm</i> of the object to the value <i>val</i>.</li>
<li> <i>bool status( )</i> — status "Running" of the archiver.</li></ul>
<p><span id="SYS.Archive" title="#SYS.Archive">Functions of object's archive (SYS.Archive["va_Archive"]):</span>
</p>
<ul><li> <i>ElTp cfg( string nm )</i> — gets the value of the configuration field <i>nm</i> of the object.</li>
<li> <i>bool cfgSet( string nm, ElTp val )</i> [<span style="color:red">access to the appropriate subsystem</span>] — sets the configuration field <i>nm</i> of the object to the value <i>val</i>.</li>
<li> <i>bool status( )</i> — status "Running" of the archive.</li>
<li> <i>int end( string arch = "" )</i> — end time of data of the archive for the archiver <i>arch</i>, in microseconds.</li>
<li> <i>int begin( string arch = "" )</i> — begin time of data of the archive for the archiver <i>arch</i>, in microseconds.</li>
<li> <i>int period( string arch = "" )</i> — period of data of the archive for the archiver <i>arch</i>, in microseconds.</li>
<li> <i>TArrayObj archivatorList( )</i> — list of archivers that use this archive as a source.</li>
<li> <i>VarType getVal( int tm, bool up_ord = false, string arch = "" )</i> — gets a value from the archive for the time <i>tm</i>, tightening up <i>up_ord</i> and archiver <i>arch</i>:
<ul><li> <i>tm</i> — time of the requested value, in microseconds, set to 0 for "end()"; this attribute is also an output, so the real time of the received value is placed here if it is a variable;</li>
<li> <i>up_ord</i> — tighten the time of the requested value to the top of the grid;</li>
<li> <i>arch</i> — request archiver, set in an empty line to check all archivers, set to "&lt;buffer&gt;" to handle only the buffer.</li></ul></li>
<li> <i>bool setVal( int tm, VarType vl, string arch = "" )</i> [<span style="color:red">access to the Archive-History subsystem</span>] — sets the value <i>vl</i> to the archive for the time <i>tm</i> and the archiver <i>arch</i>:
<ul><li> <i>tm</i> — time of the set value, in microseconds;</li>
<li> <i>vl</i> — value;</li>
<li> <i>arch</i> — archiver of the set request, set in an empty line for all archivers, set to "&lt;buffer&gt;" to handle only the buffer.</li></ul></li>
<li> <i>Array getVals( int begTm, int endTm, int period, string arch = "" )</i> — gets for the archive/history values from <i>begTm</i> and up to <i>endTm</i> for the archiver <i>arch</i>:
<ul><li> <i>begTm</i> — begin time of the requesting data range, in microseconds, will be changed to the real data begin;</li>
<li> <i>endTm</i> — end time of the requesting data range, in microseconds;</li>
<li> <i>period</i> — period of the data, in microseconds, must be necessarily specified and will be used the maximum one from the archive, will be changed to the real data period;</li>
<li> <i>arch</i> — requesting archiver, set to empty to try for the buffer and all archivers, set to "&lt;buffer&gt;" to process only the buffer.</li></ul></li>
<li> <i>bool setVals( Array buf, int tm, int period, string arch = "" )</i> [<span style="color:red">access to the Archive-History subsystem</span>] — sets for the archive/history values <i>buf</i> to the archive from the begin time <i>tm</i>, the values period <i>period</i> and the archiver <i>arch</i>.
<ul><li> <i>buf</i> — array of the values to set;</li>
<li> <i>tm</i> — begin time of the setting data range, in microseconds;</li>
<li> <i>period</i> — period of the setting data, in microseconds, must be necessarily specified and will be used the maximum one from the archive, will be changed to the real data period;</li>
<li> <i>arch</i> — setting archiver, set to empty to set for the buffer and all archivers, set to "&lt;buffer&gt;" to set only the buffer.</li></ul></li></ul>
<h2><span class="mw-headline" id="Subsystem_.22Transports.22_.28SYS.Transport.29"><span class="mw-headline-number">9</span> <span id="SYSTransport" title="#SYSTransport">Subsystem "Transports" (SYS.Transport)</span></span></h2>
<p>Functions of the subsystem object:
</p>
<ul><li> <i>TCntrNodeObj outAt( string addr );</i> — common-unified output transport connection at the address <i>addr</i> in the forms:</li></ul>
<dl><dd><dl><dd> "<b>{TrModule}.[out_]{TrID}[:{TrAddr}]</b>" — typical output with automatic creation <i>TrID</i> at it missing and allowing <i>TrAddr</i>;</dd>
<dd> "<b>{TrModule}.in_{TrID}:{RemConId}</b>" — initiative input with the connection identifier in <i>RemConId</i>.</dd></dl>
<ul><li> <i>TrModule</i> — transport module, as is <a href="Modules/Sockets.html" title="Special:MyLanguage/Modules/Sockets">Sockets</a>, <a href="Modules/SSL.html" title="Special:MyLanguage/Modules/SSL">SSL</a>, <a href="Modules/Serial.html" title="Special:MyLanguage/Modules/Serial">Serial</a>;</li>
<li> <i>TrID</i> — transport identifier;</li>
<li> <i>TrAddr</i> — transport specific address;</li>
<li> <i>RemConId</i> — remote initiative connection ID.</li></ul></dd></dl>
<p>Functions of the input transport object (SYS.Transport["Modul"]["in_Transp"]):
</p>
<ul><li> <i>ElTp cfg( string nm )</i> — gets the value of the configuration field <i>nm</i> of the object.</li>
<li> <i>bool cfgSet( string nm, ElTp val )</i> [<span style="color:red">access to the appropriate subsystem</span>] — sets the configuration field <i>nm</i> of the object to the value <i>val</i>.</li>
<li> <i>string status()</i> — string status of the transport.</li>
<li> <i>string addr( string vl = "" )</i> — address of the transport, sets the non-empty value <i>vl</i>.</li>
<li> <i>string writeTo(string sender, string mess)</i> — sends the message <i>mess</i> to the sender <i>sender</i>, as a reply.</li>
<li> <i>TArrayObj associateTrsList()</i> — associated output transports list to that input one.</li>
<li> <i>TCntrNodeObj associateTr( string id )</i> — getting the associated transport at that connection <i>id</i>.</li>
<li> <i>ElTp conPrm( string id, ElTp val = EVAL, string cfg = "" )</i> — common handling the connection time parameter <i>id</i> with setting to the value <i>val</i> at presence; request for configuration parameter of the connection time with registration at the first time from the configuration <i>cfg</i> in the form "{SRC}\n{NAME}\n{HELP}".</li>
<li> <i>bool setConPrm( string id, ElTp val )</i> — setting the connection time parameter <i>id</i> to the value <i>val</i>, only for compatibility.</li></ul>
<p>Functions of the output transport object (SYS.Transport["Modul"]["out_Transp"]):
</p>
<ul>
<li><i>bool isNetwork( )</i> — the sign — "The transport is network one", what is specified by the timeouts in seconds.</li>
<li><i>ElTp cfg( string nm )</i> — gets the value of the configuration field <i>nm</i> of the object.</li>
<li><i>bool cfgSet( string nm, ElTp val )</i> [<span style="color:red">access to the appropriate subsystem</span>] — sets the configuration field <i>nm</i> of the object to the value <i>val</i>.</li>
<li><i>string status()</i> — string status of the transport.</li>
<li><i>bool start( bool vl = EVAL, int tm = 0 )</i> — returns the transport status "Running", starts/stops it by <i>vl</i> (if it is not EVAL). For starting you can set the specific timeout <i>tm</i>.</li>
<li><i>string addr( string vl = "" )</i> — address of the transport, sets the non-empty value <i>vl</i>.</li>
<li><i>string timings( string vl = "", isDef = true )</i> — timings of the transport, sets the non-empty value <i>vl</i> and as default one for <i>isDef</i>.</li>
<li><i>int attempts( int vl = EVAL )</i> — attempts of the transport connection, sets the non-EVAL value <i>vl</i>.</li>
<li><i>ElTp conPrm( string id, ElTp val = EVAL, string cfg = "" )</i> — common handling the connection time parameter <i>id</i> with setting to the value <i>val</i> at presence; request for configuration parameter of the connection time with registration at the first time from the configuration <i>cfg</i> in the form "{SRC}\n{NAME}\n{HELP}".</li>
<li><i>bool setConPrm( string id, ElTp val )</i> — setting the connection time parameter <i>id</i> to the value <i>val</i>, only for compatibility.</li>
<li><i>string messIO( string mess, real timeOut = 0, int inBufLen = -1 );</i> — sends the message <i>mess</i> via the transport with the waiting time of the response <i>timeOut</i> (in seconds) and reads an response (Buffer) in <i>inBufLen</i> byte. In the case of a zero timeout, this time is taken from the settings of the output transport. The <i>timeOut</i> in negative (&lt; -1e-3) disables the transport request/respond mode and allows for independent reading/writing to a buffer IO, with the reading timeout <i>timeOut</i> in absolute. For negative <i>inBufLen</i> the buffer size sets to STR_BUF_LEN(10000) and "0" disables the reading at all.<br />
<a class="image" href="http://oscada.org/wiki/File:At.png"><img alt="At.png" height="22" src="files/At.png" width="22" /></a> If your transport means getting data in parts for a request then for several devices on single bus-transport, use the function into single thread but there is not a way to lock the transport into the user API. Single thread that is any object of controller of DAQ and <a href="Modules/UserProtocol.html" title="Special:MyLanguage/Modules/UserProtocol">the module "User protocol"</a> locks the transport internally before self user procedures execution.
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre><span class="nx">rez</span> <span class="o">=</span> <span class="nx">SYS</span><span class="p">.</span><span class="nx">Transport</span><span class="p">.</span><span class="nx">Serial</span><span class="p">.</span><span class="nx">out_ttyUSB0</span><span class="p">.</span><span class="nx">messIO</span><span class="p">(</span><span class="nx">SYS</span><span class="p">.</span><span class="nx">strFromCharCode</span><span class="p">(</span><span class="mh">0x4B</span><span class="p">,</span><span class="mh">0x00</span><span class="p">,</span><span class="mh">0x37</span><span class="p">,</span><span class="mh">0x40</span><span class="p">),</span><span class="mf">0.2</span><span class="p">);</span>
<span class="c1">//Wait for all the message tail by timeout and empty result</span>
<span class="k">while</span><span class="p">(</span><span class="nx">rez</span><span class="p">.</span><span class="nx">length</span> <span class="o">&amp;&amp;</span> <span class="p">(</span><span class="nx">trez</span><span class="o">=</span><span class="nx">SYS</span><span class="p">.</span><span class="nx">Transport</span><span class="p">.</span><span class="nx">Serial</span><span class="p">.</span><span class="nx">out_ttyUSB0</span><span class="p">.</span><span class="nx">messIO</span><span class="p">(</span><span class="s2">""</span><span class="p">)).</span><span class="nx">length</span><span class="p">)</span> <span class="nx">rez</span> <span class="o">+=</span> <span class="nx">trez</span><span class="p">;</span>
</pre></div></li>
<li><i>string messIO( XMLNodeObj req, string prt );</i> — sends the request <i>req</i> to the protocol <i>prt</i> to perform a communication session through the transport and in assistance of the protocol. Returns a string with error in the format "<b>{errCod}:{errText}</b>" which empty for successful request.
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre><span class="nx">req</span> <span class="o">=</span> <span class="nx">SYS</span><span class="p">.</span><span class="nx">XMLNode</span><span class="p">(</span><span class="s2">"TCP"</span><span class="p">);</span>
<span class="nx">req</span><span class="p">.</span><span class="nx">setAttr</span><span class="p">(</span><span class="s2">"id"</span><span class="p">,</span><span class="s2">"test"</span><span class="p">).</span><span class="nx">setAttr</span><span class="p">(</span><span class="s2">"reqTm"</span><span class="p">,</span><span class="mi">500</span><span class="p">).</span><span class="nx">setAttr</span><span class="p">(</span><span class="s2">"node"</span><span class="p">,</span><span class="mi">1</span><span class="p">).</span><span class="nx">setAttr</span><span class="p">(</span><span class="s2">"reqTry"</span><span class="p">,</span><span class="mi">2</span><span class="p">).</span><span class="nx">setText</span><span class="p">(</span><span class="nx">SYS</span><span class="p">.</span><span class="nx">strFromCharCode</span><span class="p">(</span><span class="mh">0x03</span><span class="p">,</span><span class="mh">0x00</span><span class="p">,</span><span class="mh">0x00</span><span class="p">,</span><span class="mh">0x00</span><span class="p">,</span><span class="mh">0x05</span><span class="p">));</span>
<span class="nx">SYS</span><span class="p">.</span><span class="nx">Transport</span><span class="p">.</span><span class="nx">Sockets</span><span class="p">.</span><span class="nx">out_testModBus</span><span class="p">.</span><span class="nx">messIO</span><span class="p">(</span><span class="nx">req</span><span class="p">,</span><span class="s2">"ModBus"</span><span class="p">);</span>
<span class="nx">test</span> <span class="o">=</span> <span class="nx">Special</span><span class="p">.</span><span class="nx">FLibSYS</span><span class="p">.</span><span class="nx">strDec4Bin</span><span class="p">(</span><span class="nx">req</span><span class="p">.</span><span class="nx">text</span><span class="p">());</span>
</pre></div></li>
</ul>
<h2><span class="mw-headline" id="Subsystem_.22Protocols.22_.28SYS.Protocols.29"><span class="mw-headline-number">10</span> Subsystem "Protocols" (SYS.Protocols)</span></h2>
<h3><span class="mw-headline" id="Module_Protocol.HTTP"><span class="mw-headline-number">10.1</span> Module <a href="Modules/HTTP.html" title="Special:MyLanguage/Modules/HTTP">Protocol.HTTP</a></span></h3>
<p><b>Input part of the module object (SYS.Protocol.HTTP.{In})</b>
</p>
<ul><li> <i>bool setUser( string user )</i> — changes the user linked to the authentication session ID.
<ul><li> <i>user</i> — user to change.</li></ul></li>
<li> <i>bool pgAccess(string URL)</i> — checks for accessing the page, pointed by the <i>URL</i>.
<ul><li> <i>URL</i> — URL of the checking page.</li></ul></li>
<li> <i>string pgCreator(string cnt, string rcode = "", string httpattrs = "Content-Type: text/html;charset={SYS}", string htmlHeadEls = "", string forceTmplFile = "" )</i> — forms for a page or a resource from the content <i>cnt</i>, wrapped to HTTP with the result <i>rcode</i>, with HTTP additional attributes <i>httpattrs</i>, HTML additional head's element <i>htmlHeadEls</i>, forced to template file <i>forceTmplFile</i>.
<ul><li> <i>cnt</i> — content of the page or the resource (images, XML, CSS, JavaScript, ...)&nbsp;;</li>
<li> <i>rcode</i> — HTTP result code, like to "200 OK"; empty value there disables addition of the HTTP header;</li>
<li> <i>httpattrs</i> — additional HTTP-attributes, mostly this is "Content-Type" which by default sets to "text/html;charset={SYS}"; only for "Content-Type: text/html" will be wrapped to internal/service or force <i>forceTmplFile</i> HTML-template;</li>
<li> <i>htmlHeadEls</i> — additional HTML-header's tag, it's mostly META with "Refresh" to the specified URL;</li>
<li> <i>forceTmplFile</i> — force template file to override the internal/service or the main-page template.</li></ul></li></ul>
<p><br />
</p>
<h2><span class="mw-headline" id="Subsystem_.22User_interfaces.22_.28SYS.UI.29"><span class="mw-headline-number">11</span> <span id="SYSUI" title="#SYSUI">Subsystem "User interfaces" (SYS.UI)</span></span></h2>
<p>Functions of the subsystem object:
</p>
<ul><li> <i>string mimeGet(string fnm);</i> — obtaining the MIME type at the file name <i>fnm</i>.</li></ul>
<h3><span class="mw-headline" id="Module_QTStarter"><span class="mw-headline-number">11.1</span> Module <a href="Modules/QTStarter.html" title="Special:MyLanguage/Modules/QTStarter">QTStarter</a></span></h3>
<p><b>The module object (SYS.UI.QTStarter)</b>
</p>
<ul><li> <i>Array sensors()</i> — get all available sensors of the Qt mobility, returns "false" if no sensor is available.</li></ul>
<h3><span class="mw-headline" id="Module_UI.VCAEngine"><span class="mw-headline-number">11.2</span> Module <a href="Modules/VCAEngine.html" title="Special:MyLanguage/Modules/VCAEngine">UI.VCAEngine</a></span></h3>
<div class="floatright"><a class="image" href="http://oscada.org/wiki/File:Oscada_UserOM_VCAEngine.png" title="User object model of the module VCAEngine."><img alt="User object model of the module VCAEngine." height="238" src="files/Oscada_UserOM_VCAEngine.png" width="352" /></a></div>
<p><b>Object "Session" ( this.ownerSess() )</b>
</p>
<ul><li> <i>string user( )</i> — current session user.</li>
<li> <i>int alrmQuietance( int quit_tmpl, string wpath = "", bool ret = false )</i> — quiets of the violations <i>wpath</i> with the template <i>quit_tmpl</i>. If <i>wpath</i> is empty string then the global quietance makes. In the string <i>wpath</i>, by symbol ';', can be enumerated addresses of several widgets. When set the <i>ret</i>, the quietance return is performed.</li>
<li> <i>int reqTm( )</i> — last request time in seconds from the epoch of 1/1/1970.</li>
<li> <i>string reqUser( )</i> — last request user.</li>
<li> <i>string reqLang( )</i> — last request language.</li>
<li> <i>int userActTm( )</i> — last user action time in seconds from the epoch of 1/1/1970.</li>
<li> <i>bool uiCmd( string cmd, string prm, string src )</i> — sends a UI command of the pages managing, that is: "open", "next", "prev"; for more details see in <a href="#Events">the events section</a>. This function must be in the priority of using to the pages managing before the direct writing to the page attributes "pgOpen" and "pgOpenSrc" due it is single method of the correct work with <a href="#Project">the linked pages</a>.</li>
<li> <i>int period( bool isReal = false )</i> — getting the session processing period, <i>isReal</i> for the real one.</li></ul>
<p><b>Object "Widget" (this)</b>
</p>
<ul><li> <i>TCntrNodeObj ownerSess( )</i> — session object for the current widget.</li>
<li> <i>TCntrNodeObj ownerPage( )</i> — parent page object for the current widget.</li>
<li> <i>TCntrNodeObj ownerWdg( bool base = false )</i> — parent widget object for the current widget. If set <i>base</i> then returns the parent page objects also.</li>
<li> <i>TCntrNodeObj wdgAdd( string wid, string wname, string parent )</i> — adds the new widget <i>wid</i> with the name <i>wname</i> and based on the library widget <i>parent</i>.</li></ul>
<div class="mw-highlight mw-content-ltr" dir="ltr" style="margin-left: 15px"><pre><span class="c1">//Adds the new widget, based at the text primitive</span>
<span class="nx">nw</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">wdgAdd</span><span class="p">(</span><span class="s2">"nw"</span><span class="p">,</span> <span class="s2">"New widget"</span><span class="p">,</span> <span class="s2">"/wlb_originals/wdg_Text"</span><span class="p">);</span>
<span class="nx">nw</span><span class="p">.</span><span class="nx">attrSet</span><span class="p">(</span><span class="s2">"geomX"</span><span class="p">,</span> <span class="mi">50</span><span class="p">).</span><span class="nx">attrSet</span><span class="p">(</span><span class="s2">"geomY"</span><span class="p">,</span> <span class="mi">50</span><span class="p">);</span>
</pre></div>
<ul><li> <i>bool wdgDel( string wid )</i> — deletes the widget <i>wid</i>.</li>
<li> <i>TCntrNodeObj wdgAt( string wid, bool byPath = false )</i> — attaches to child or global widget, by the path <i>byPath</i>. For missing and invalid widgets the function will return "false" when a correct widget in it conversion to BOOLEAN will return "true". In the case of global connection, you can use absolute or relative path to the widget. For starting point of the absolute address acts the root object of the module "VCAEngine", which means the first element of the absolute address is session identifier, which is ignored. The relative address takes the countdown from the current widget. Special element of the relative address is an element of parent node "..".</li>
<li> <i>Array attrList()</i> — list of the widget attributes.</li>
<li> <i>bool attrPresent( string attr )</i> — checks to presence fact of the attribute <i>attr</i> of the widget.</li>
<li> <i>ElTp attr( string attr, bool fromSess = false )</i> — value of the attribute <i>attr</i> of the widget or from the session <i>fromSess</i>. For missing attributes will be return empty string.</li>
<li> <i>TCntrNodeObj attrSet( string attr, ElTp vl, bool toSess = false )</i> — sets the value <i>vl</i> to the attribute <i>attr</i> of the widget or to the session, by <i>toSess</i>. The object is returned for the function concatenation.</li>
<li> <i>string link( string attr, bool prm = false )</i> — link for the widget attribute <i>attr</i>. At set <i>prm</i> requests the link for the attributes block (parameter), represented by the attribute. </li>
<li> <i>string linkSet( string attr, string vl, bool prm = false )</i> — sets the link for the widget attribute <i>attr</i>. At set <i>prm</i>, sets the link for the attributes block (parameter), represented by the attribute.</li></ul>
<div class="mw-highlight mw-content-ltr" dir="ltr" style="margin-left: 15px"><pre><span class="c1">//Sets the link to the parameter for the eight trend</span>
<span class="k">this</span><span class="p">.</span><span class="nx">linkSet</span><span class="p">(</span><span class="s2">"el8.name"</span><span class="p">,</span> <span class="s2">"prm:/LogicLev/experiment/Pi"</span><span class="p">,</span> <span class="kc">true</span><span class="p">);</span>
</pre></div>
<ul><li> <i>string {resource,mime}( string addr, string MIME = "" )</i> — resource object by the address <i>addr</i> (the direct link to the resource or the widget attribute contained the link) with the <i>MIME</i>, from the session table or the source. It is designed for the resource objects edition and that substitution to this session's context, for example, images SVG.</li>
<li> <i>int {resourceSet,mimeSet}( string addr, string data, string MIME = "" )</i> — sets the resource object to <i>data</i> with <i>MIME</i> by the address <i>addr</i>.</li>
<li> <i>int messDebug( string mess ); int messInfo( string mess ); int messNote( string mess ); int messWarning( string mess ); int messErr( string mess ); int messCrit( string mess ); int messAlert( string mess ); int messEmerg( string mess );</i> — formats of the program message <i>mess</i> with the category — the widget path.</li>
<li> <i>int calcPer( int set = EVAL )</i> — the actual calculation-processing period getting and setting at <i>set</i> not EVAL. There reserved the special values:
<ul><li> <b>0</b> — if you want the session period processing;</li>
<li> <b>-1</b> — if you want to use the parent widget/page/project processing period in the cascade;</li>
<li> <b>-2</b> — for disable the periodic processing in whole;</li>
<li> <b>-3</b> — no session time period, getting the projecting one.</li></ul></li></ul>
<p><b>Object "Widget" of the primitive "Document" (this)</b>
</p>
<ul><li> <i>string getArhDoc( int nDoc)</i> — text of the archive document to "nDoc" depth (0-{aSize-1}).</li></ul>
<p><br />
</p>
<h2><span class="mw-headline" id=".22Special.22_subsystem_.28SYS.Special.29"><span class="mw-headline-number">12</span> "Special" subsystem (SYS.Special)</span></h2>
<h3><span class="mw-headline" id="Module_Library_of_the_system_API_of_the_user_programming_area_.28Special.FLibSYS.29"><span class="mw-headline-number">12.1</span> Module <a href="Modules/FLibSYS.html" title="Special:MyLanguage/Modules/FLibSYS">Library of the system API of the user programming area (Special.FLibSYS)</a></span></h3>
<p><b>The object "Functions library" (SYS.Special.FLibSYS)</b>
</p>
<ul><li> <i>ElTp {funcID}(ElTp prm1, ...)</i> — call the library function <i>{funcID}</i>. Return result of the called function.</li></ul>
<p><b>The object "User function" (SYS.Special.FLibSYS["funcID"])</b>
</p>
<ul><li> <i>ElTp call(ElTp prm1, ...)</i> — call the function with parameters <i>prm{N}</i>. Return result of the called function.</li></ul>
<h3><span class="mw-headline" id="Module_Library_of_standard_mathematical_functions_.28Special.FLibMath.29"><span class="mw-headline-number">12.2</span> Module <a href="Modules/FLibMath.html" title="Special:MyLanguage/Modules/FLibMath">Library of standard mathematical functions (Special.FLibMath)</a></span></h3>
<p><b>The object "Functions library" (SYS.Special.FLibMath)</b>
</p>
<ul><li> <i>ElTp {funcID}(ElTp prm1, ...)</i> — call the library function <i>{funcID}</i>. Return result of the called function.</li></ul>
<p><b>The object "User function" (SYS.Special.FLibMath["funcID"])</b>
</p>
<ul><li> <i>ElTp call(ElTp prm1, ...)</i> — call the function with parameters <i>prm{N}</i>. Return result of the called function.</li></ul>
<h3><span class="mw-headline" id="Module_Library_of_functions_of_compatibility_with_SCADA_Complex1_of_the_firm_DIYA_Ltd_.28Special.FLibComplex1.29"><span class="mw-headline-number">12.3</span> Module <a href="Modules/FLibComplex1.html" title="Special:MyLanguage/Modules/FLibComplex1">Library of functions of compatibility with SCADA Complex1 of the firm DIYA Ltd (Special.FLibComplex1)</a></span></h3>
<p><b>The object "Functions library" (SYS.Special.FLibComplex1)</b>
</p>
<ul><li> <i>ElTp {funcID}(ElTp prm1, ...)</i> — call the library function <i>{funcID}</i>. Return result of the called function.</li></ul>
<p><b>The object "User function" (SYS.Special.FLibComplex1["funcID"])</b>
</p>
<ul><li> <i>ElTp call(ElTp prm1, ...)</i> — call the function with parameters <i>prm{N}</i>. Return result of the called function.</li></ul>
<p><br />
</p>
<h2><span class="mw-headline" id="Libraries_of_the_user_functions"><span class="mw-headline-number">13</span> Libraries of the user functions</span></h2>
<p>Currently, OpenSCADA has libraries of the user functions written using this API user. Some of them are designed for exclusive use with this API. All user libraries are presented in the following table: 
</p>
<table class="wikitable">

<tr>
<th> Name </th>
<th> Version </th>
<th> License </th>
<th> Source </th>
<th> Languages
</th></tr>
<tr>
<td colspan="5"> <i>Libraries of the data sources, services and processing</i>
</td></tr>

<tr>
<td> <a href="Libs_Main.html" title="Special:MyLanguage/Libs/Main">Main library</a>
</td>
<td> 2.3 </td>
<td> GPLv2 </td>
<td> OscadaLibs.db (<a class="external text" href="http://oscada.org/svn/trunk/OpenSCADA/data/LibsDB/OscadaLibs.sql" rel="nofollow noreferrer noopener" target="_blank">SQL</a>, <a class="external" href="http://oscada.org/wiki/File:OscadaLibs.db.gz" title="File:OscadaLibs.db.gz">GZip</a>) &gt; DAQ.tmplb_base </td>
<td> en, uk, ru
</td></tr>

<tr>
<td> <a href="Libs_Devices.html" title="Special:MyLanguage/Libs/Devices">Industrial devices library</a>
</td>
<td> 3.1 </td>
<td> GPLv2 </td>
<td> OscadaLibs.db (<a class="external text" href="http://oscada.org/svn/trunk/OpenSCADA/data/LibsDB/OscadaLibs.sql" rel="nofollow noreferrer noopener" target="_blank">SQL</a>, <a class="external" href="http://oscada.org/wiki/File:OscadaLibs.db.gz" title="File:OscadaLibs.db.gz">GZip</a>) &gt; DAQ.tmplb_DevLib
</td>
<td> en, uk, ru
</td></tr>

<tr>
<td> <a href="Libs_LowLevelDevices.html" title="Special:MyLanguage/Libs/LowLevelDevices">Low level sensors and chips library</a>
</td>
<td> 1.6 </td>
<td> GPLv2 </td>
<td> OscadaLibs.db (<a class="external text" href="http://oscada.org/svn/trunk/OpenSCADA/data/LibsDB/OscadaLibs.sql" rel="nofollow noreferrer noopener" target="_blank">SQL</a>, <a class="external" href="http://oscada.org/wiki/File:OscadaLibs.db.gz" title="File:OscadaLibs.db.gz">GZip</a>) &gt; DAQ.tmplb_LowDevLib </td>
<td> en, uk, ru
</td></tr>

<tr>
<td> <a href="Libs_Service_procedures.html" title="Special:MyLanguage/Libs/Service procedures">Service procedures library</a>
</td>
<td> 1.2 </td>
<td> GPLv2 </td>
<td> OscadaLibs.db (<a class="external text" href="http://oscada.org/svn/trunk/OpenSCADA/data/LibsDB/OscadaLibs.sql" rel="nofollow noreferrer noopener" target="_blank">SQL</a>, <a class="external" href="http://oscada.org/wiki/File:OscadaLibs.db.gz" title="File:OscadaLibs.db.gz">GZip</a>) &gt; DAQ.JavaLikeCalc.servProc </td>
<td> en, uk, ru
</td></tr>

<tr>
<td> <a href="Libs_Regulation_elements.html" title="Special:MyLanguage/Libs/Regulation elements">Regulation elements library</a>
</td>
<td> 1.0 </td>
<td> GPLv2 </td>
<td> OscadaLibs.db (<a class="external text" href="http://oscada.org/svn/trunk/OpenSCADA/data/LibsDB/OscadaLibs.sql" rel="nofollow noreferrer noopener" target="_blank">SQL</a>, <a class="external" href="http://oscada.org/wiki/File:OscadaLibs.db.gz" title="File:OscadaLibs.db.gz">GZip</a>) &gt; DAQ.JavaLikeCalc.regEl </td>
<td> en, uk, ru
</td></tr>

<tr>
<td> <a href="Libs_Technological_apparatuses.html" title="Special:MyLanguage/Libs/Technological apparatuses">Library of models of the technological apparatuses</a>
</td>
<td> 2.0 </td>
<td> GPLv2
</td>
<td> OscadaLibs.db (<a class="external text" href="http://oscada.org/svn/trunk/OpenSCADA/data/LibsDB/OscadaLibs.sql" rel="nofollow noreferrer noopener" target="_blank">SQL</a>, <a class="external" href="http://oscada.org/wiki/File:OscadaLibs.db.gz" title="File:OscadaLibs.db.gz">GZip</a>) &gt; DAQ.JavaLikeCalc.techApp
</td>
<td> en, uk, ru
</td></tr>
<tr>
<td colspan="5"> <i>Graphical elements' libraries of the OpenSCADA module <a href="Modules/VCAEngine.html" title="Special:MyLanguage/Modules/VCAEngine">UI.VCAEngine</a></i>
</td></tr>

<tr>
<td> <a href="Libs_Main_graphical_elements.html" title="Special:MyLanguage/Libs/Main graphical elements">Main elements library of the user interface</a>
</td>
<td> 2.2 </td>
<td> GPLv2
</td>
<td> vcaBase.db (<a class="external text" href="http://oscada.org/svn/trunk/OpenSCADA/data/LibsDB/vcaBase.sql" rel="nofollow noreferrer noopener" target="_blank">SQL</a>, <a class="external" href="http://oscada.org/wiki/File:VcaBase.db.gz" title="File:VcaBase.db.gz">GZip</a>) &gt; VCA.wlb_Main
</td>
<td> en, uk, ru
</td></tr>

<tr>
<td> <a href="Libs_Mnemo_elements.html" title="Special:MyLanguage/Libs/Mnemo elements">Mnemonic elements library of the user interface</a>
</td>
<td> 1.0 </td>
<td> GPLv2
</td>
<td> vcaBase.db (<a class="external text" href="http://oscada.org/svn/trunk/OpenSCADA/data/LibsDB/vcaBase.sql" rel="nofollow noreferrer noopener" target="_blank">SQL</a>, <a class="external" href="http://oscada.org/wiki/File:VcaBase.db.gz" title="File:VcaBase.db.gz">GZip</a>) &gt; VCA.wlb_mnEls
</td>
<td> en, uk, ru
</td></tr>

<tr>
<td> <a href="Libs_Electrical_elements.html" title="Special:MyLanguage/Libs/Electrical elements">Electrical elements library of the user interface</a>
</td>
<td> 2.0 </td>
<td> GPLv2 </td>
<td> vcaElectroEls.db (<a class="external text" href="http://oscada.org/svn/trunk/OpenSCADA/data/LibsDB/vcaElectroEls.sql" rel="nofollow noreferrer noopener" target="_blank">SQL</a>, <a class="external" href="http://oscada.org/wiki/File:VcaElectroEls.db.gz" title="File:VcaElectroEls.db.gz">GZip</a>) &gt; VCA.wlb_ElectroEls </td>
<td> en, uk, ru
</td></tr>
<tr>
<td colspan="5"> <i>Combined libraries</i>
</td></tr>

<tr>
<td> <a href="Libs_Documents.html" title="Special:MyLanguage/Libs/Documents">Reports' and documents' library</a>
</td>
<td> 2.0, 2.1 </td>
<td> GPLv2 </td>
<td>
<p>OscadaLibs.db (<a class="external text" href="http://oscada.org/svn/trunk/OpenSCADA/data/LibsDB/OscadaLibs.sql" rel="nofollow noreferrer noopener" target="_blank">SQL</a>, <a class="external" href="http://oscada.org/wiki/File:OscadaLibs.db.gz" title="File:OscadaLibs.db.gz">GZip</a>) &gt; DAQ.JavaLikeCalc.doc<br />
vcaBase.db (<a class="external text" href="http://oscada.org/svn/trunk/OpenSCADA/data/LibsDB/vcaBase.sql" rel="nofollow noreferrer noopener" target="_blank">SQL</a>, <a class="external" href="http://oscada.org/wiki/File:VcaBase.db.gz" title="File:VcaBase.db.gz">GZip</a>) &gt; VCA.wlb_doc
</p>
</td>
<td> en, uk, ru
</td></tr>

<tr>
<td> <a href="Libs_Prescriptions.html" title="Special:MyLanguage/Libs/Prescriptions">Prescriptions</a>
</td>
<td> 1.1, 1.1 </td>
<td> GPLv2 </td>
<td>
<p>OscadaLibs.db (<a class="external text" href="http://oscada.org/svn/trunk/OpenSCADA/data/LibsDB/OscadaLibs.sql" rel="nofollow noreferrer noopener" target="_blank">SQL</a>, <a class="external" href="http://oscada.org/wiki/File:OscadaLibs.db.gz" title="File:OscadaLibs.db.gz">GZip</a>) &gt; DAQ.tmplb_PrescrTempl<br />
vcaBase.db (<a class="external text" href="http://oscada.org/svn/trunk/OpenSCADA/data/LibsDB/vcaBase.sql" rel="nofollow noreferrer noopener" target="_blank">SQL</a>, <a class="external" href="http://oscada.org/wiki/File:VcaBase.db.gz" title="File:VcaBase.db.gz">GZip</a>) &gt; VCA.wlb_prescr
</p>
</td>
<td> en, uk, ru
</td></tr></table>
<p><br />
</p>
<h2><span class="mw-headline" id="Links"><span class="mw-headline-number">14</span> Links</span></h2>
<ul><li> <a class="external" href="http://oscada.org/wiki/File:Oscada_UserOM.odg" title="File:Oscada UserOM.odg">Diagram: User object model of the core OpenSCADA.</a></li></ul>






</div><table style="border-top: dotted 2px #999999; margin-top: 20pt; color: gray;" width="100%"><tr><td style="text-align: left;" width="40%"><a href="http://oscada.org/wiki/Documents/User_API/en">Documents/User_API/en</a> - <a href="http://oscada.org/en/main/about-the-project/licenses/">GFDL</a></td><td style="text-align: center;">March 2025</td><td style="text-align: right;" width="40%">OpenSCADA 1+r3012</td></tr></table></body>
</html>