Mingcedar

Product: Mingcedar Studio DESIGNER

Create and verify a reusable template | Mingcedar Studio

Create reusable templates and configure placeholders, instance values, Input, alarms and page parameters.

Published Updated

<section id="template-creation" class="docs-block docs-block-intro docs-block-current"> <span class="section-kicker">Templates</span> <h2>Create and verify a reusable template</h2> <p>Create reusable templates and configure placeholders, instance values, Input, alarms and page parameters.</p> <div class="docs-detail-list"> <article id="template-creation-item-1" class="docs-detail-row"> <strong>Choose the value mechanism before authoring</strong> <p>Choose by when the value is known: template variables for instance addresses, Input or Runtime Variable for temporary page input, and page parameters for navigation context.</p> <ul> <li>Template instance variable: filled after insertion, such as &lt;PLC&gt; or &lt;RUN_TAG&gt;.</li><li>Input template value: entered at runtime and read with template.getValue(&quot;instance name&quot;).</li><li>Runtime Variable: temporary state shared inside the current runtime page.</li><li>Page or popup parameter: sent while opening the destination and read with GetPageParameter*.</li><li>PLC Tag: device data binding. Shared access from several pages is not page-parameter passing.</li> </ul> </article><article id="template-creation-item-2" class="docs-detail-row"> <strong>1. Build a parameterized template from scratch</strong> <p>Draw and configure the components, then group them for reuse. Replace per-instance differences with angle-bracket placeholders in text, Tag fields or script strings. In scripts, keep placeholders inside string literals.</p> <ul> <li>Visible text: Device &lt;DEVICE_NO&gt;.</li><li>Tag path: &lt;PLC&gt;.&lt;RUN_TAG&gt;.</li><li>Script string: ReadTagBoolean(&quot;&lt;PLC&gt;.&lt;RUN_TAG&gt;&quot;, false).</li><li>Bit reference: &lt;STATUS_TAG&gt;[3]; keep the bit index outside the placeholder.</li><li>Parameterize only values that genuinely vary by instance.</li> </ul> <pre class="docs-code-block"><code>var running = ReadTagBoolean(&quot;&lt;PLC&gt;.&lt;RUN_TAG&gt;&quot;, false);

var alarming = GetAlarmTags([

&quot;&lt;PLC&gt;.&lt;ALARM_TAG&gt;&quot;

]);

return running &amp;&amp; !alarming;</code></pre> </article><article id="template-creation-item-3" class="docs-detail-row"> <strong>2. Name placeholders and compose tag paths</strong> <p>Wrap each variable in one pair of angle brackets. Use short ASCII uppercase names such as &lt;PLC&gt;, &lt;DEVICE_NO&gt;, and &lt;RUN_TAG&gt; in shared templates. Names may also contain non-ASCII letters, but cannot contain dots, hyphens, or spaces. Build Tag paths from variables and fixed separators.</p> <ul> <li>Valid names include &lt;PLC&gt;, &lt;DB_01&gt;, and &lt;DEVICE_NO&gt;.</li><li>Correct path: &lt;PLC&gt;.&lt;RUN_TAG&gt;; incorrect: &lt;PLC.RUN_TAG&gt;.</li><li>Correct bit reference: &lt;STATUS_TAG&gt;[3]; incorrect: &lt;STATUS_TAG[3]&gt;.</li><li>Do not use &lt;RUN-TAG&gt; or &lt;RUN TAG&gt;.</li><li>Case differences create different fields; keep one spelling for one meaning.</li> </ul> <pre class="docs-code-block"><code>// Instance: PLC=LINE01, RUN_TAG=PUMP01.RUN

ReadTagBoolean(&quot;&lt;PLC&gt;.&lt;RUN_TAG&gt;&quot;, false)

// Exported target: LINE01.PUMP01.RUN</code></pre> </article><article id="template-creation-item-4" class="docs-detail-row"> <strong>3. Save and review Captured variables</strong> <p>Select the group, save it in Templates and fill its name, group and order. Check Captured variables: fix missing or case-duplicated names in the source. Their order controls Template Edit field order.</p> <ul> <li>Template name: identify the device or purpose, for example Pump faceplate.</li><li>Group: organize by process, equipment, or project.</li><li>Sort order: lower values appear earlier in the library.</li><li>Captured variables: verify every name, count, and order.</li><li>After saving, insert a fresh instance from the library and test it.</li> </ul> </article><article id="template-creation-item-5" class="docs-detail-row"> <strong>4. Insert an instance and fill its variables</strong> <p>Insert a template, select its root group and open Templates → Edit Instance. Check identity and position, then fill Template variables. Values affect this instance only and copy with it.</p> <ul> <li>Select the instance root, not a child shape inside it.</li><li>Enter replacement values without angle brackets, for example LINE01 for PLC.</li><li>The same placeholder in text, behavior tags, and script strings receives one instance value.</li><li>A blank can be saved during editing, but tag placeholders must be resolved before final export.</li><li>Reopen Template Edit and confirm values, position, and size after saving.</li> </ul> <pre class="docs-code-block"><code>PLC = LINE01

RUN_TAG = PUMP01.RUN

ALARM_TAG = PUMP01.ALARM

// &lt;PLC&gt;.&lt;RUN_TAG&gt; -&gt; LINE01.PUMP01.RUN</code></pre> </article><article id="template-creation-item-6" class="docs-detail-row"> <strong>5. Input values and cross-page parameters</strong> <p>Use Input for runtime entry. Read Plain Input with template.getValue(&quot;input instance name&quot;); use Runtime Variable for same-page state. Pass device code or mode through navigation parameters, then read with GetPageParameter and explicitly convert numbers or booleans.</p> <ul> <li>Plain Input: the value stays on that Input instance until a script reads it.</li><li>Runtime Variable: temporary same-page linkage; do not treat it as durable cross-page state.</li><li>PLC Tag mode: confirmation submits according to host permission and write rules.</li><li>Page parameters: a contract between the opening page and the destination.</li><li>For complete open-and-receive examples, continue to Script scope and parameter passing.</li> </ul> <pre class="docs-code-block"><code>var setpoint = template.getValue(&quot;Speed input&quot;);

var deviceCode = GetPageParameter(&quot;deviceCode&quot;, &quot;&quot;);

var editMode = GetPageParameter(&quot;editMode&quot;, &quot;false&quot;) === &quot;true&quot;;</code></pre> </article><article id="template-creation-item-7" class="docs-detail-row"> <strong>6. Configure Alarm columns and filter scope</strong> <p>An Alarm template controls both the visible columns and the alarm scope. Select only the required columns from Time, Message, Level, PLC, Function Group, Device Group, Signal Group, Tags, Status, and Acknowledged. Then enter project codes in the relevant filters. Separate several values with commas or lines and use codes rather than display names.</p> <ul> <li>Tags: full device-code.tag-code, for example &lt;PLC&gt;.&lt;ALARM_TAG&gt;.</li><li>PLC codes: device-code only, for example &lt;PLC&gt;.</li><li>Function groups: device-code.group-code.</li><li>Device groups: device-code.group-code.</li><li>Signal groups: device-code.group-code.</li><li>An empty filter dimension adds no extra restriction; test with a known active alarm after export.</li> </ul> </article><article id="template-creation-item-8" class="docs-detail-row"> <strong>7. Test active alarms in template scripts</strong> <p>Alarm helpers return whether an active alarm matches the scope, for driving icons, colors or text. They accept arrays or comma/newline-separated text; they do not query history or acknowledge alarms.</p> <ul> <li>GetAlarmTags(values): match full tag codes.</li><li>GetAlarmPlcCodes(values): match PLC or device codes.</li><li>GetAlarmFunctionGroupCodes(values): match function-group codes.</li><li>GetAlarmDeviceGroupCodes(values): match device-group codes.</li><li>GetAlarmSignalGroupCodes(values): match signal-group codes.</li> </ul> <pre class="docs-code-block"><code>var hasTagAlarm = GetAlarmTags([

&quot;&lt;PLC&gt;.&lt;ALARM_TAG&gt;&quot;

]);

var hasDeviceAlarm = GetAlarmDeviceGroupCodes([

&quot;&lt;PLC&gt;.&lt;DEVICE_GROUP&gt;&quot;

]);

return hasTagAlarm || hasDeviceAlarm;</code></pre> </article><article id="template-creation-item-9" class="docs-detail-row"> <strong>8. Pre-export validation and troubleshooting</strong> <p>Insert at least two instances with different values and verify that their text, tags, alarm scope, and interactions remain independent. Check where Input values are stored and verify page-parameter field names and destination defaults. If export reports an unresolved variable, fill the instance or correct the source template instead of hiding the issue with fixed text.</p> <ul> <li>Unresolved &lt;variable&gt;: check for an empty instance field or an unsupported placement.</li><li>Missing Captured variable: check whether a dot, hyphen, space, or bit index was put inside the name.</li><li>Placeholder unchanged in a script: keep it inside a JavaScript string literal.</li><li>Value lost after navigation: it may need a page parameter instead of a Runtime Variable.</li><li>Wrong alarm scope: distinguish full tags, PLC codes, and the three group-code fields.</li><li>After updating a template, validate a newly inserted instance.</li> </ul> </article> </div> <div class="docs-note-grid"> <figure id="template-creation-image-1" class="docs-note-card manual-doc-image-card"> <img src="/WEB_img/HQPPT/current/templates/save-template.png" alt="Current Save as template UI with template name, group, sort order, and Captured variables" loading="lazy" decoding="async"> <figcaption> <strong>Save and review a template</strong> <p>Current Save as template UI: verify identity, grouping, ordering, and Captured variables before saving.</p> </figcaption> </figure><figure id="template-creation-image-2" class="docs-note-card manual-doc-image-card"> <img src="/WEB_img/HQPPT/current/templates/edit-instance-variables.png" alt="Current Edit template instance UI with position, size, and template variables" loading="lazy" decoding="async"> <figcaption> <strong>Fill instance variables</strong> <p>Template Edit changes only the selected instance. Verify its source and geometry before filling values.</p> </figcaption> </figure><figure id="template-creation-image-3" class="docs-note-card manual-doc-image-card"> <img src="/WEB_img/HQPPT/current/templates/edit-alarm-template.png" alt="Current Alarm template editor with visible columns and alarm filters" loading="lazy" decoding="async"> <figcaption> <strong>Configure an Alarm template</strong> <p>Choose the required alarm columns and limit scope by tag, PLC, function group, device group, or signal group.</p> </figcaption> </figure> </div> </section>