Back

Topic

[KB1268]How to Generate and Open a Data Export from WebVue

Tags: Data Export, IIS, Webvue

3 minutes ago
By LM
Options
Print
Applies to:
PcVue 16.3.4 onwards
Summary:
This article explains how to trigger a Data Export generation from a WebVue client and how to open the resulting file directly in the browser. It covers the Data Export configuration, the status variable with enumerated labels, the SCADA Basic scripts, the mimic setup, and the required IIS virtual directory configuration.
Details:

Overview

The workflow consists of two actions available from a WebVue mimic:

  1. Generate – triggers the Data Export engine to produce an Excel file.
  2. Open – opens the generated file directly in the WebVue browser tab.

status variable (GENERAL.EXPORTS.DIAGNOSTIC.STATUS) reflects the current state of the export in real time, using enumerated labels to display a human-readable status (e.g., IdleIn progressDoneError).


Step 1 – Configure the Data Export

In PcVue Application Explorer > Data Analysis > Data Exports, create a new export named DIAGNOSTIC and configure it as follows:

SettingValue
Export nameDIAGNOSTIC
Output typeExcel (.xlsx)
Template fileDiagnostic.xlsx (in DataExportTemplates\)
Output file nameDiagnostic
Output folderDataExports\ (relative to the project root)
Behaviour if file existsOverwrite
Status variableGENERAL.EXPORTS.DIAGNOSTIC.STATUS

The output file will be written to the DataExports\ folder at the root of the project, for example:

C:\PcVue Projects\WebVueDataExport\DataExports\Diagnostic.xlsx

Step 2 – Add Enumerated Labels to the Status Variable

The Data Export engine writes a numeric code to the status variable to indicate the current export state. Adding enumerated labels to that variable makes the status readable at a glance in mimics with “Label display” animation.

image
image

Note: The exact numeric values and their meanings are documented in the Data Export section of the PcVue Reference Guide.


Step 3 – Write the SCADA Basic Scripts

The two actions are implemented as subroutines in the program PROGLOADED.SCB (located in the P\ folder of the project). This program is loaded at PcVue startup.

' PROGRAM : PROGLOADED.scb
' Loaded at start-up from the program INIT.scb

SUB GenerateExport()
  Export("GENERATE", "DIAGNOSTIC");
END SUB

SUB OpenExportFromWebVue()
  Webvue("HYPERLINK", "/DataExports/Diagnostic.xlsx", 1);
END SUB

GenerateExport()

Calls the Export() instruction with the GENERATE mode to trigger the production of the export named DIAGNOSTIC. The engine updates the status variable throughout the generation process.

OpenExportFromWebVue()

Calls the Webvue() instruction with the HYPERLINK mode to instruct the WebVue client to navigate to the URL /DataExports/Diagnostic.xlsx. The third parameter 1 opens the file in a new browser tab.

Note: The /DataExports/ path is a virtual directory configured in IIS – see Step 5.


Step 4 – Configure the Mimic

Open mimic Mimic 01 in PcVue. The mimic contains three objects:

4a – Status display (text object)

A text object shows the current value of the status variable using the Display animation linked to @GENERAL.EXPORTS.DIAGNOSTIC.STATUS. Thanks to the enumerated labels configured in Step 2, the label (e.g., Done) is displayed instead of the raw numeric value.

4b – “GENERATE” button

A push-button calls GenerateExport() on click via a Run Program animation:

Animation propertyValue
ProgramPROGLOADED.SCB
SubroutineGenerateExport

4c – “OPEN” button

A second push-button calls OpenExportFromWebVue() on click via a Run Program animation:

Animation propertyValue
ProgramPROGLOADED.SCB
SubroutineOpenExportFromWebVue

This button also has a Visible animation based on @System.LocalHost.Session.Type set to show the button only in WebVue sessions (session type = 100), hiding it in PcVue desktop sessions. This is intentional: the Webvue("HYPERLINK", ...) instruction only works in a WebVue context.

image
image

Step 5 – Configure the IIS Virtual Directory

The Webvue("HYPERLINK", "/DataExports/Diagnostic.xlsx", 1) instruction uses the path /DataExports/ relative to the WebVue web application root in IIS. By default, IIS does not know where to find this folder, so a virtual directory must be added.

Procedure

  1. Open IIS Manager (inetmgr).
  2. Expand the tree to locate the WebVue website.
  3. Right-click on it and select Add Virtual Directory…
  4. Fill in the dialog: FieldValue Alias as DataExports and Physical path as Full path to the DataExports\ folder of the PcVue project, e.g. C:\PcVue Projects\WebVueDataExport\DataExports
  5. Click OK.
image
image
image
image

Important: The IIS application pool user (or the IUSR account) must have Read permission on the DataExports\ folder so that IIS can serve the file.

After this configuration, the URL https://<webclient_binding>/DataExports/Diagnostic.xlsx will resolve to the physical file generated by PcVue.


End-to-End Workflow

Once everything is configured:

  1. The WebVue operator connects to the WebVue interface and navigates to Mimic 01 – Data Export.
  2. The operator clicks GENERATE. The GenerateExport() subroutine fires Export("GENERATE", "DIAGNOSTIC").
  3. The status label updates in real time: Idle → In progress → Done.
  4. When the status label shows Done, the operator clicks OPEN. The OpenExportFromWebVue() subroutine fires Webvue("HYPERLINK", "/DataExports/Diagnostic.xlsx", 1).
  5. The browser opens a new tab and downloads/displays Diagnostic.xlsx from the IIS virtual directory.

Sample Project

The sample PcVue project used in this article is available here:

WebVueDataExport.zip

Created on: 06 May 2026