Mingcedar

Product: Mingcedar Studio DESIGNER

Runtime data export: JSON, tables, and current Tag values | Mingcedar Studio

Call ExportJson, ExportTable, or ExportTags from Click Script to download current page data through the operator's browser. This serves a different purpose from Export HTML screen-package creation.

Published Updated

<div class="manual-doc-article manual-doc-article-section"><h2 id="runtime-data-export">Data export: Runtime data export: JSON, tables, and current Tag values</h2>

Call ExportJson, ExportTable, or ExportTags from Click Script to download current page data through the operator's browser. This serves a different purpose from Export HTML screen-package creation.

<div class="doc-card-list">

<article class="doc-card">

<h3 id="runtime-data-export-item-1">1. Export structured JSON</h3>

<p>ExportJson(value, fileName?) exports an object, array, or other serializable value. Its default filename is export.json. Strings remain strings. Read a JSON Tag with ReadTagJson first when exporting its structured value.</p>

<div class="manual-code" data-code-language="text"><div class="manual-code-toolbar"><span>Text</span><span class="manual-code-tools"><small>Text</small><button type="button" data-copy-code data-copied="Copied" data-failed="Select and copy the code" aria-label="Copy code: Text">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>ExportJson(</span></span>

<span class="line"><span> ReadTagJson("PLC_LINE01.REPORT01.SUMMARY", null),</span></span>

<span class="line"><span> "line01-production-summary.json"</span></span>

<span class="line"><span>);</span></span></code></pre></div>

</article>

<article class="doc-card">

<h3 id="runtime-data-export-item-2">2. Export a current-page data table</h3>

<p>ExportTable(nameOrId, fileName?, format?) supports built-in data tables on the current page. Formats are csv, json, xlsx, and excel (an xlsx alias), with CSV as the default. Supply the Table component&#39;s Name from Behavior Browser or its shapeId, with matching case. Use a unique component name; the displayed Table name is a title and cannot locate the component. The export includes all currently bound rows, including rows outside the scroll viewport, and preserves cell display text.</p>

<div class="manual-code" data-code-language="text"><div class="manual-code-toolbar"><span>Text</span><span class="manual-code-tools"><small>Text</small><button type="button" data-copy-code data-copied="Copied" data-failed="Select and copy the code" aria-label="Copy code: Text">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>ExportTable("Line01ProductionTable", "line01-production.csv", "csv");</span></span>

<span class="line"><span>ExportTable("Line01ProductionTable", "line01-production.xlsx", "xlsx");</span></span></code></pre></div>

</article>

<article class="doc-card">

<h3 id="runtime-data-export-item-3">3. Export current Tag values and quality</h3>

<p>ExportTags(tagNames, fileName?, format?) accepts one Tag name or a non-empty name array. It supports csv, json, and xlsx, defaulting to CSV. It exports current values without querying history. CSV / XLSX columns are Tag, Value, Quality; JSON records contain name, value, quality.</p>

<div class="manual-code" data-code-language="text"><div class="manual-code-toolbar"><span>Text</span><span class="manual-code-tools"><small>Text</small><button type="button" data-copy-code data-copied="Copied" data-failed="Select and copy the code" aria-label="Copy code: Text">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>ExportTags(</span></span>

<span class="line"><span> ["PLC_LINE01.PUMP01.SPEED", "PLC_LINE01.PUMP01.RUN"],</span></span>

<span class="line"><span> "line01-pump-status.json",</span></span>

<span class="line"><span> "json"</span></span>

<span class="line"><span>);</span></span></code></pre></div>

</article>

<article class="doc-card">

<h3 id="runtime-data-export-item-4">4. Preconditions and result meaning</h3>

<p>Start downloads from a user click after data is loaded and the page has permission to read the relevant Tags. A returned filename confirms that downloading was initiated, not that the file was saved. Files go to the browser download location, not an Mingcedar server directory.</p>

<ul>

<li>Missing tables, unavailable Tags, and unsupported formats report errors instead of substituting zero.</li>

<li>Existing poor-quality values retain their quality label and are not valid field readings.</li>

<li>JSON distinguishes numbers, booleans, and null. Table exports use display text.</li>

<li>The browser or host can restrict downloads. Check page feedback and download permissions when an export fails.</li>

</ul>

</article>

</div>

</div>