With the “File Transfer” input action, a file can be transferred from an operating variant (target or web visualization) to the PLC as well as to and from the PLC. This works either by means of a file transfer (“Type”: “File”) or streaming (“Type”: “Streaming”).
The action has the effect that a file selection dialog is displayed in the visualization at runtime. There the visualization user can select a file which will be transferred either to or from the PLC: For a transfer from a PLC to the visualization, the “Save File” dialog opens. For the transfer from the visualization to the PLC, the “Open File” dialog opens.
“Transfer” |
|
“Direction” |
Direction of file transfer |
“From PLC to Visualization” |
The object specified in “File name” or “Streaming instance name” is transferred from the PLC to the visualization. The “Save File” file selection dialog is displayed in the visualization at runtime. |
“From Visualization to PLC” |
The file specified by the visualization user is transferred to the PLC and saved in the file path specified in “File name” or “Streaming instance name”. The “Open File” file selection dialog is displayed in the visualization at runtime. |
“Type” |
Determines how the file is transferred
|
“Type” |
“File” The data transfer is done by file transfer. |
“File name” |
File path (type
NOTE: If a user specifies the file path in the visualization by means of a “Text Field” element, the masking character NOTE: In the case that the file path is specified by the user, it should be checked by the application in order to prevent files from being read or overwritten accidentally. |
“Type” |
“Streaming” The data transfer is done by streaming. |
“Streaming instance name” |
Instance path (type Type Type |
“Control flags” |
Note: The variable is evaluated only for transfer direction “From Visualization to PLC”. Variable (type Determines how the object (file or instance object) is handled on the file system of the PLC. Two flags are provided for this with which the variable can be set.
Options
Example: |
Example
The transfer direction is “From Visualization to PLC” (write).
Example: A new recipe file Recipes/Recipe_2021.txt
has been created in the visualization device. The visualization user selects this
file and wants to save the file on the PLC under the same name. Because the control
flags are set accordingly, a message window opens and the visualization user can confirm
that the file will be overwritten.
PROGRAM PLC_PRG VAR xVisuToggle : BOOL; dwControlFlag : DWORD := VisuElems.VisuEnumFileTransferControlFlags.UseOriginalFileName + VisuElems.VisuEnumFileTransferControlFlags.ConfirmFileOverwriteInPlc; strFileName: STRING := '/Recipes/Recipe_new.txt'; END_VAR
“Status Variables” |
|
“Transfer active” |
Boolean variable (optional)
|
“Transfer successful” |
Boolean variable (optional)
|
“Error code” |
|
“Use local visualization files” |
Requirement: The option is available when “Transfer visualization files to the PLC” has been specified as the direction.
|