writefile
- Last UpdatedMay 02, 2023
- 3 minute read
The writefile statement exports formatted data from the application. It supports a simple template file tagging language to enable you to prepare template files. It can also copy binary files without applying tag processing.
Platform support
This node is fully supported on XR-Windows, XR-Portable Windows, XR-Portable iOS, XR-Portable Android, and XR-Portable WASM platforms.
|
XR-WIN |
XR-P-WIN |
XR-P-IOS |
XR-P-AND |
XR-P-WASM |
|---|---|---|---|---|
|
Full support |
Full support |
Full support |
Full support |
Full support |
|
|
|
|
|
|
Template file format
This is a template example.
<?xml version="1.0" encoding="utf-8" ?>
<ConfigFile xmlns="http://vrmmp.it/IPSConfigFile" Name="DOE_preview">
<ContextDir>../contents/Kiosk</ContextDir>
[if:@badge.selectedMission@==0:
<Map>Kiosk_Furnace</Map>
<Map>Task_FurnaceEN</Map> ]
[if:@badge.selectedMission@!=0:
PLEASE INSERT A VALID CONFIGURATION HERE
]
<Training>
<ID>[@badge.userID@]</ID>
<SessionName>[@badge.selectedMission@]</SessionName>
</Training>
In the example, there are two directives:
-
[text] This is used to print the text or the value of a field (node field or variable).
-
[if:condition text] This is used to print the text or the value of a field (node field or variable), but only if the condition is verified.
Code example
This is a code example for the writefile statement.
<command name="generatefile">
<writefile input="@custom.templateFile@" output="@custom.generatedFile@"/>
</command>
Position
The writefile statement can be used only inside a Command node node.
Fields
These are the parameters for writefile statement.
|
Fields |
Type |
Use |
Default value |
Description |
|---|---|---|---|---|
|
condition |
sstring |
Optional |
No default value |
Applies a condition to the function execution. |
|
input |
sstring |
Mandatory |
No default value |
The source file path. It can be absolute or relative to the application exe. This value must be the same command you would call from shell being inside the application folder to launch the external program. |
|
output |
sstring |
Mandatory |
No default value |
The path of the created file. It can be absolute or relative to the application exe. This value must be the same command you would call from shell being inside the application folder to launch the external program. |
|
type |
sstring |
Optional |
Template |
When set to Binary, copies source file to destination as it is. When set to Template, processes tag replacements before writing. |