13. Reports, Sequencer and Batch Processing¶
This chapter answers questions about automatic evaluations: running Sequencer sequences, starting them from other programs, processing many measurement files in one run and filling report tables with placeholders.
13.1. Sequencer Basics¶
13.1.1. What is the Sequencer and how do I structure an automatic evaluation?¶
The Sequencer runs a list of predefined actions in a workspace, for example open a document, load a data file, exchange the data and export a PDF (see Sequencer Actions). Sequences can call other sequences, and individual actions can run under a condition or in a loop. The action Run Script executes any UniScript file, so you can add functionality that the standard actions do not offer. Start with the Sequencer Tutorial.
Useful building blocks in scripts:
The
Seq_*functions exchange values with the Sequencer, for example Seq_SetRuntimeValue, Seq_GetRuntimeValue, Seq_GetSlotPath and Seq_GetWorkspacePath.The
auto_*functions load data and edit diagrams automatically. They remember the current file, so for example auto_LoadDataset after auto_ImportData uses the same file (see Overview Automation).File helpers such as GetOpenFileName, GetDropFileNames and CopyFile.
Tip: in the online help index type a prefix such as Seq_ or auto_ to list a whole function family.
See also: The Sequencer, Runtime Values.
13.1.2. How do I start a Sequencer sequence from the command line and pass values to it?¶
Start UniPlot with these parameters:
/seq: name of the sequence./ws(optional): workspace folder. UniPlot switches to this workspace for the run and then back to the last active workspace./rv(optional): list of runtime values./automation(optional): starts UniPlot without displaying the main window (see AppGetCommandLine).
C:\Uniplot\uniplot.exe /ws "D:\Workspaces\COP Evaluation" /seq "COP Main" /rv "DATAPATH = D:\Datafiles\MyFile.csv, MAKE_PDF_EXPORT = 1" /automation
Rules for the values:
Put each value in double quotes.
Write paths without a trailing backslash:
"D:\Workspaces\COP Evaluation"is correct,"D:\Workspaces\COP Evaluation\"is not. Windows reads\"as an escaped quote, so the following parameters become part of the path./rvis a list ofNAME = valueentries, separated by commas. Put the whole list in one pair of double quotes.UniPlot splits the
/rvlist at every comma and then at the equals sign. An entry that does not consist of exactly one name and one value is ignored without a message. A value must therefore not contain a comma or an equals sign.Spaces around names and values are removed, but quote characters are not. If the calling tool (for example a test bench system) adds quotes to a path, also typographic quotes, they become part of the path and the file is not found. Pass the bare path.
The sequence reads the runtime values (RV), for example in the file definition of actions or in a condition (see Runtime Values). To close UniPlot after the run, add the action Snippet with the functionality SHUTDOWN at the end of the sequence.
The sequence works in the Sequencer but fails when started from a script (for example a VBS or batch file, or the workspace is not found):
Pass the workspace explicitly with
/wsand the sequence with/seq. Put each value in double quotes and write the path without a trailing backslash.In VBS, double the quote characters inside the command string (
"").Make sure that the user account that runs the script can access the workspace and the data folders.
Insert the action Snippet with LOG RVs at the start of the sequence. It writes all received runtime values to the UniPlot log, so you can see what arrived.
See also: Sequencer Tutorial, The Sequencer, Runtime Values.
13.1.3. How do I replace the data of a document with the Sequencer action “Data Exchange”?¶
The action Data Exchange works on data that is assigned to a data slot. Use the actions in this order:
Load Document loads the template or document (
.ipz). Do not use it to load data files.Browse for File lets the user select the data file (for example a CSV or TXT file). Skip it if the path is given by a runtime value.
Data Load assigns the data file to a data slot (parameter TARGET SLOT) and selects the import filter.
Data Exchange replaces the data in the active document with the data of the slot (SOURCE DATA SLOT).
See also: Action Data Load, Data Slots, Action Browse for File.
13.1.4. The Sequencer does not convert a .txt file to an .nc2 file during the data exchange and formula channels are missing¶
Check in Tools > Formula Configuration… that the calculation of formulas on import is activated (see Formula Configuration). The data exchange of the Sequencer does not calculate formulas by default, unlike the standard data exchange of the document.
Also use the correct order of actions: Load Document, Browse for File, Data Load, Data Exchange (see How do I replace the data of a document with the Sequencer action “Data Exchange”?).
13.1.5. The Sequencer action Data Exchange autoscales the axes. How can I keep my axis scaling?¶
The action Data Exchange always autoscales all axes, unless the option SHOW OPTIONS DIALOG is enabled. The autoscale setting of the manual data exchange is not used.
Workarounds:
Interactive runs: enable SHOW OPTIONS DIALOG in the action. The data exchange options dialog opens during the run, and you can switch autoscaling off.
Unattended runs: replace the action with a Run Script action. In the script call DocExchangeDataFiles with
obj.bAutoscale = FALSE(see the example in the function description).
See also: Sequencer Actions, DocExchangeDataFiles, How do I replace the data of a document with the Sequencer action “Data Exchange”?.
13.1.6. How can the Sequencer save a PDF with a custom path and file name?¶
Take the folder and the file name from runtime values. In the action PDF Export, the EXPORT FOLDER can be a folder inside the workspace, an absolute path or a runtime value. The FILE NAME can be fixed or a runtime value. To build the name dynamically:
Add a Run Script action before the PDF Export action.
In the script, compute the folder and the name, for example from the template name, from the data file name (see Seq_GetSlotPath) or from an attribute of the data.
Store them in runtime values with Seq_SetRuntimeValue.
In the PDF Export action, choose the input mode From Runtime Value (button RV) for EXPORT FOLDER and FILE NAME and select these runtime values.
To export a document that is not the active one, set SOURCE DOCUMENT to Handle from RV (see How can a sequence process all data files in a folder and save one PDF with one page per file?). See File=>PDF-Export for the PDF export settings.
See also: Action PDF Export, Runtime Values.
13.1.7. How can I update a picture in a template with the Sequencer before the PDF export?¶
There are two ways.
Linked picture file (no script needed)
In the template, select the picture and open Edit > Object Properties > Picture.
Set Linktype to Linked to file (or Embedded with link to file).
In the sequence, write or copy the new picture file under the same file name before the action Load Document.
The picture is read from the file when the document is loaded, so the PDF export shows the current picture.
Run Script action
After Load Document and before PDF Export, add a Run Script action. In the script:
Find the picture object, for example with PageGetAllObjects and ObjGetName.
Set the new picture file with
ImageSetFileName(hImg, ssFile).If the file has changed under the same name, reload it with
ImageUpdate(hImg).
See also: Edit=>Object Properties=>Picture, ImageSetFileName, ImageUpdate, Sequencer Actions.
13.2. Batch Processing of Many Files¶
13.2.1. How can I run a template automatically on all measurement files and save each result under the measurement file name?¶
Use the Sequencer with a loop over the files:
Create a main sequence with the actions Browse for File (enable ALLOW MULTIFILE SELECT) to select the data files and, if needed, a second Browse for File to select the template. The selected paths are stored comma separated in a runtime value, for example
FILE_LIST.Put the processing in a subsequence: Load Document (the template), Data Load, Data Exchange and PDF Export. Use a runtime value, for example
DATAPATH, as the data file in Data Load.In the main sequence add the action Run Sequence for the subsequence and activate its Loop. Use
FILE_LISTas the source runtime value andDATAPATHas the destination runtime value. The subsequence runs once per file;DATAPATH_IDXholds the loop number.To save each PDF next to the data file and with its name, compute the folder and file name from
DATAPATHin a Run Script action before the PDF export (see How can the Sequencer save a PDF with a custom path and file name?).
A ready-made example workspace with a looping sequence (multi data exchange) is available from UniPlot support. Unzip it and place the folder in your Sequencer workspace folder, then switch to it in the Sequencer (see Sequencer Tutorial).
See also: Loop, Action Browse for File, Sequencer Tutorial.
13.2.2. How can a sequence process all data files in a folder and save one PDF with one page per file?¶
Loop over the files as described in How can I run a template automatically on all measurement files and save each result under the measurement file name? and collect the pages in a main document:
Load the template once as the main document and keep its document handle in a runtime value (for example
HANDLE_DOCUMENT_MAIN; the action Load Document can provide the handle automatically).In the loop, for each file make a copy of the template with CopyFile, load the copy, load the data file and exchange the data.
Copy the resulting page into the main document with DocCopyPage and close the temporary document with DocDestroy.
After the loop export the main document with the action PDF Export. Choose Handle from RV as the source document and select the runtime value with the main document handle.
Read the handles in the script with Seq_GetRuntimeValue, for example Seq_GetRuntimeValue("HANDLE_DOCUMENT_MAIN").
See also: Action PDF Export, Runtime Values.
13.2.3. How can I export many .ipz files to PowerPoint in one run?¶
Use the UniScript function PageSendToPowerPoint in a script that loops over the selected files. The example in the function description selects .ipw or .ipz files with GetOpenFileName (multiple selection), loads each document and writes a PowerPoint file.
Register the script as a command and a toolbar button, as shown in the example.
Run the script with F4.
Click the new button and select one or more files. Each file is exported as
.pptx.
PowerPoint must be installed because the function uses its COM interface.
See also: File=>Send to PowerPoint.
13.3. Report Tables and Placeholders¶
13.3.1. How do I show header or global attributes of the loaded file in a diagram or table and keep them updated on data exchange?¶
Use placeholders such as $EngineNumber$ in tables or text boxes. They are filled when the data is exchanged (exchange once with the same file to fill them) or with the graph type Text: Load Placeholder Text in the data browser (see Browser=>Load Placeholder Text).
From R2023.4 the graph type Text: Create Channel Info Table creates a table with the placeholders for you.
A date attribute is written with date and time. Set the display format in the table with the right mouse button, Configuration, cell format Date/Time.
To split a text, use a second cell with a formula that starts with
=and takes the first cell as input.A backslash in a placeholder (for example
\D) can be interpreted as an escape sequence. Write\\Dto avoid it.
See also: Text Placeholder, Edit Object=>Placeholder-Dialog.
13.3.2. How can I fill a table with minimum and maximum values of channels without UniScript?¶
There are several ready-made tables that update automatically:
Select a curve, press F5 to display the cursor and choose Cursor > Cursor Data Table… in the context menu of the curve (see Data=>Cursor Data Table). The table shows the cursor positions and can be updated with the cursors.
The field functions @f{xystatistic} and @f{xyminmax} show statistics and minimum/maximum values of a dataset in a text object.
For a custom table:
Create the table.
Double-click a cell and enter a placeholder for the channel, for example
$Channel name.max()$.In the data browser select the graph type Text: Load Placeholder Text and load it.
The functions maxi and mini return the index of the largest and the smallest value of a vector. Use the index to read the X value at the maximum or minimum.
13.3.3. Can I put a drop-down list (list box) into a table cell of a page?¶
Not directly: UniPlot tables have no drop-down cell type. Since R2025.3 you can turn a table cell into a button that runs your own UniScript function on double-click. That function can show the list:
Double-click the cell to open the cell text dialog (see Edit Object=>Table).
In the Callback field enter the function as
MyFunction?Arg1,Arg2. Arguments can be strings (without quotes), numbers, or@, which is replaced by the table handle. The cell gets a button style.In
MyFunction, show a DialogBox with a list box that contains the choices.Write the selected entry into the cell with TableSetText. TableGetSelection returns the double-clicked cell.
In older releases you can only attach a double-click function to the whole table, with OBJSetCallbackFunction(hTable, "ObjectDblClickCallBack", "MyFunction").
See also: Edit Object=>Table, DialogBox, TableSetText, TableGetSelection, OBJSetCallbackFunction.
13.3.4. How can I switch an emission analysis report between English and German?¶
When you start the emission evaluation, select the report template in the main dialog (field Template). Templates whose names contain _en are the English versions; use the template without _en for German. The default English template is addin\rs_emission\etc_template_en.ipw.
See also: Template, Main Dialog.
id-1337368