Product: Mingcedar Studio DESIGNER
Variables, Tags, and template parameters: field rules | Mingcedar Studio
Identify whether a field expects a Tag name, a variable name, a number, or text. The leading = marks an expression in selected configuration fields. It is not general script syntax and does not grant Tag access.
<div class="manual-doc-article manual-doc-article-section"><h2 id="variables-tags-template-expressions">Data binding: Variables, Tags, and template parameters: field rules</h2>
Identify whether a field expects a Tag name, a variable name, a number, or text. The leading = marks an expression in selected configuration fields. It is not general script syntax and does not grant Tag access.
<div class="doc-card-list">
<article class="doc-card">
<h3 id="variables-tags-template-expressions-item-1">1. Distinguish Tag names, runtime variables, and template parameters</h3>
<p>Mingcedar supplies Tag data. Runtime variables hold state on the current page. Template parameters replace placeholders when configuring an instance. A variable containing a Tag name is still a string; a read method retrieves its value. Examples use PLC_LINE01, PUMP01, and TANK01. Replace them with names configured in your project.</p>
<ul>
<li>Full Tag name: <code>PLC_LINE01.PUMP01.SPEED</code>.</li>
<li>Calculated Tag name: <code>Line01TotalFlow</code>, exactly as saved in the host.</li>
<li>Runtime variables: <code>selectedSpeedTag</code> holds a name; <code>speedValue</code> holds a number.</li>
<li>Template placeholders: <code><PLC></code> and <code><PUMP_CODE></code>, replaced with instance values.</li>
</ul>
<div class="manual-code" data-code-language="javascript"><div class="manual-code-toolbar"><span>JavaScript</span><span class="manual-code-tools"><small>JavaScript</small><button type="button" data-copy-code data-copied="Copied" data-failed="Select and copy the code" aria-label="Copy code: JavaScript">Copy code</button><span class="manual-code-status" role="status"></span></span></div><pre tabindex="0" class="docs-code-block shiki github-light" style="background-color:#fff;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#6A737D">// Page Script: store the target name</span></span>
<span class="line"><span style="color:#D73A49">var</span><span style="color:#24292E"> selectedSpeedTag </span><span style="color:#D73A49">=</span><span style="color:#032F62"> "PLC_LINE01.PUMP01.SPEED"</span><span style="color:#24292E">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#6A737D">// Behavior Setup Script: read the current value during evaluation</span></span>
<span class="line"><span style="color:#D73A49">var</span><span style="color:#24292E"> speedValue </span><span style="color:#D73A49">=</span><span style="color:#6F42C1"> ReadTagDouble</span><span style="color:#24292E">(selectedSpeedTag, </span><span style="color:#005CC5">0</span><span style="color:#24292E">);</span></span></code></pre></div>
</article>
<article class="doc-card doc-card-warn">
<h3 id="variables-tags-template-expressions-item-2">2. Target fields in Tag Text and write behaviors</h3>
<p>Target tag in Tag Text and Target Tag in Write Tag or Write Tag Bit identify the read or write target. Enter a full fixed name directly, or a variable that holds the name. Use = for object properties or computed names to distinguish them from literal Tag paths. The control performs the read or write; do not call ReadTag or WriteTag inside the target field.</p>
<ul>
<li>Fixed target: <code>PLC_LINE01.PUMP01.SPEED</code>.</li>
<li>Name variable: <code>selectedSpeedTag</code>; define it first and ensure it returns a string.</li>
<li>Object property: <code>=bindingConfig.speedTag</code>.</li>
<li>Write Tag Bit takes the parent Tag name and a separate Bit Index from 0 to 31.</li>
</ul>
</article>
<article class="doc-card">
<h3 id="variables-tags-template-expressions-item-3">3. = expressions in Input and charts</h3>
<p>The Input PLC Tag field, chart series Tag fields, Gauge Tag, and JSON Tag treat a fixed entry as a name. To obtain the name from a page variable, enter =selectedSpeedTag. The expression must return a Tag name string, not the current Tag value or a JSON object.</p>
<ul>
<li>Fixed Input target: <code>PLC_LINE01.PUMP01.SPEED_SETPOINT</code>.</li>
<li>Dynamic Input target: <code>=selectedSetpointTag</code>.</li>
<li>Dynamic chart target: <code>=selectedSpeedTag</code>.</li>
<li>JSON Tag: <code>PLC_LINE01.REPORT01.CHART_DATA</code>; use <code>=selectedJsonTag</code> for a dynamic name.</li>
</ul>
</article>
<article class="doc-card doc-card-warn">
<h3 id="variables-tags-template-expressions-item-4">4. Variable-name fields and value fields</h3>
<p>In Input Runtime Variable mode, enter the destination name, such as speedSetpointDraft. A dynamic name can use =selectedVariableName, which must return a valid variable-name string. The Variable field in Set Variable on Click identifies the assignment target; Value supplies the content to assign.</p>
<ul>
<li>Fixed variable name without quotes: <code>speedSetpointDraft</code>.</li>
<li>Dynamic Input variable: define <code>var selectedVariableName = "speedSetpointDraft";</code> in Page Script and enter <code>=selectedVariableName</code> in the field.</li>
<li>Value and Condition are expression fields: enter <code>speedValue</code> or <code>speedValue > 1200</code> directly.</li>
<li>In JavaScript, use <code>ReadTagDouble(selectedSpeedTag, 0)</code>. Do not pass <code>"=selectedSpeedTag"</code> as an API name argument.</li>
</ul>
</article>
<article class="doc-card">
<h3 id="variables-tags-template-expressions-item-5">5. Literal text and table data</h3>
<p>Table Rows and Headers accept arrays, page array variables, or functions returning arrays. Use = to request evaluation explicitly. Quote a literal title when it could be confused with a variable. Table array data and the Tag name required by JSON Chart are different input types.</p>
<ul>
<li>Headers: <code>["Equipment", "Status"]</code>.</li>
<li>Rows: <code>[["PUMP01", "Running"], ["PUMP02", "Stopped"]]</code>.</li>
<li>Dynamic rows: <code>pumpRows</code> or <code>=buildPumpRows()</code>, returning an array.</li>
<li>Literal title: <code>"Pump station operating record"</code>.</li>
</ul>
</article>
<article class="doc-card">
<h3 id="variables-tags-template-expressions-item-6">6. Combine template parameters and page variables</h3>
<p>Set template parameter PLC to PLC_LINE01 and define the equipment code in Page Script. The template replaces <PLC> during authoring. At runtime, the page variable supplies the remaining name. Built-in template expressions use Page Script variables and cannot access another behavior's Setup Script locals. Enter each part below in the location identified by its comment. Lines beginning with = belong in configuration fields, not in a JavaScript script body.</p>
<div class="manual-code" data-code-language="javascript"><div class="manual-code-toolbar"><span>JavaScript</span><span class="manual-code-tools"><small>JavaScript</small><button type="button" data-copy-code data-copied="Copied" data-failed="Select and copy the code" aria-label="Copy code: JavaScript">Copy code</button><span class="manual-code-status" role="status"></span></span></div><pre tabindex="0" class="docs-code-block shiki github-light" style="background-color:#fff;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#6A737D">// Page Script</span></span>
<span class="line"><span style="color:#D73A49">var</span><span style="color:#24292E"> selectedPumpCode </span><span style="color:#D73A49">=</span><span style="color:#032F62"> "PUMP01"</span><span style="color:#24292E">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#6A737D">// Input or chart Tag field</span></span>
<span class="line"><span style="color:#D73A49">=</span><span style="color:#032F62">"<PLC>."</span><span style="color:#D73A49"> +</span><span style="color:#24292E"> selectedPumpCode </span><span style="color:#D73A49">+</span><span style="color:#032F62"> ".SPEED"</span></span>
<span class="line"></span>
<span class="line"><span style="color:#6A737D">// Script Text: Setup Script</span></span>
<span class="line"><span style="color:#D73A49">var</span><span style="color:#24292E"> speedTagName </span><span style="color:#D73A49">=</span><span style="color:#032F62"> "<PLC>."</span><span style="color:#D73A49"> +</span><span style="color:#24292E"> selectedPumpCode </span><span style="color:#D73A49">+</span><span style="color:#032F62"> ".SPEED"</span><span style="color:#24292E">;</span></span>
<span class="line"><span style="color:#D73A49">var</span><span style="color:#24292E"> speedValue </span><span style="color:#D73A49">=</span><span style="color:#6F42C1"> ReadTagDouble</span><span style="color:#24292E">(speedTagName, </span><span style="color:#005CC5">0</span><span style="color:#24292E">);</span></span>
<span class="line"></span>
<span class="line"><span style="color:#6A737D">// Script Text: Text</span></span>
<span class="line"><span style="color:#24292E">speedValue.</span><span style="color:#6F42C1">toFixed</span><span style="color:#24292E">(</span><span style="color:#005CC5">0</span><span style="color:#24292E">) </span><span style="color:#D73A49">+</span><span style="color:#032F62"> " rpm"</span></span></code></pre></div>
</article>
<article class="doc-card doc-card-warn">
<h3 id="variables-tags-template-expressions-item-7">7. Dynamic targets and page access</h3>
<p>Variable-selected targets remain subject to export validation and Mingcedar read/write permissions. If export cannot determine a dynamic write target, use HQVISU_DECLARE_TAGS in Page Script to declare the finite candidate names associated with the expression. Those names must exist and be authorized in the host. Declarations do not bypass host permissions. Enter each part below in the location identified by its comment. Lines beginning with = belong in configuration fields, not in a JavaScript script body.</p>
<div class="manual-code" data-code-language="javascript"><div class="manual-code-toolbar"><span>JavaScript</span><span class="manual-code-tools"><small>JavaScript</small><button type="button" data-copy-code data-copied="Copied" data-failed="Select and copy the code" aria-label="Copy code: JavaScript">Copy code</button><span class="manual-code-status" role="status"></span></span></div><pre tabindex="0" class="docs-code-block shiki github-light" style="background-color:#fff;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49">var</span><span style="color:#24292E"> selectedSetpointTag </span><span style="color:#D73A49">=</span><span style="color:#032F62"> "PLC_LINE01.PUMP01.SPEED_SETPOINT"</span><span style="color:#24292E">;</span></span>
<span class="line"><span style="color:#6F42C1">HQVISU_DECLARE_TAGS</span><span style="color:#24292E">({</span></span>
<span class="line"><span style="color:#24292E"> expression: </span><span style="color:#032F62">"selectedSetpointTag"</span><span style="color:#24292E">,</span></span>
<span class="line"><span style="color:#24292E"> read: [</span><span style="color:#032F62">"PLC_LINE01.PUMP01.SPEED_SETPOINT"</span><span style="color:#24292E">, </span><span style="color:#032F62">"PLC_LINE01.PUMP02.SPEED_SETPOINT"</span><span style="color:#24292E">],</span></span>
<span class="line"><span style="color:#24292E"> write: [</span><span style="color:#032F62">"PLC_LINE01.PUMP01.SPEED_SETPOINT"</span><span style="color:#24292E">, </span><span style="color:#032F62">"PLC_LINE01.PUMP02.SPEED_SETPOINT"</span><span style="color:#24292E">]</span></span>
<span class="line"><span style="color:#24292E">});</span></span>
<span class="line"></span>
<span class="line"><span style="color:#6A737D">// Input PLC Tag field</span></span>
<span class="line"><span style="color:#D73A49">=</span><span style="color:#24292E">selectedSetpointTag</span></span></code></pre></div>
</article>
<article class="doc-card">
<h3 id="variables-tags-template-expressions-item-8">8. Evaluation failures and target changes</h3>
<p>An explicit expression that fails, returns a non-string, or retains an unresolved placeholder is not reinterpreted as another Tag name. Check variable scope, return type, template values, and name case.</p>
<ul>
<li>Changing an Input target or binding mode cancels the old unsubmitted draft. Enter a new value for the new target.</li>
<li>A write already sent is not recalled by a subsequent target change.</li>
<li>A live chart clears samples from the previous target when its dynamic target changes.</li>
<li>Runtime variables belong to the current page. Use page parameters to transfer context to another page.</li>
</ul>
</article>
</div>
</div>