The stage file action can process each file downloaded by the FTP Adapter. The stage file action can read, write, zip, unzip, and list files in a staged location known to Oracle Integration Cloud.
For example, you may include a stage file action in an integration as follows:
Configure an FTP Adapter with the following settings:
Download File operation
Unzip the File option
Input directory and download directory path
Because the ZIP file may contain multiple files, configure a for-each action below the FTP Adapter to iterate over repeated elements.
To read each file from the input directory, configure a stage file action below the for-each action to read each file from the input directory as follows:
In the Expression Builder, specify the file name and directory from which to read the file.
Specify the schema file by loading a file that contains the data structure.
Specify a name
Select the Download File operation.
Specify the input directory and download directory path(this path will be input directory for stage file list).
Select the Unzip the File option.
To configure Stage File List Operation :
From the drop-down list, select List File
|Specify the Directory to List Files from||
Click the Expression Builder icon to build an expression to specify the directory from which to list files.
|Specify the File Pattern to use||
Specify the pattern of the file name to transfer to the output directory. Click the ? icon for the list of supported patterns.
|List Files Recursively||
Select to list the files recursively.
To configure Stage File Write Operation :
From the drop-down list, select Write File
|Specify the File Name||
Click the Expression Builder icon to build an expression to specify the file name.
|Specify the Output Directory||
Click the Expression Builder icon to build an expression to specify the output directory.
|Append to Existing File||
Optionally select to append records to the existing file.
The Schema Options page is displayed if you selected a read or write stage file operation.
|Do you want to define a schema for this endpoint?||
Select Yes to define a schema format to use for the files to transfer.
|Do you want to create a new schema or use an existing one?||
Select an existing schema from the file system: Select an existing schema file. On a subsequent page of this wizard, you are prompted to select the existing schema (XSD) file from the file system.
Select the existing schema file to use. This field appears if you selected an existing schema from the file system.
Displays the selected schema file name.
Select the schema element. This field is displayed after the schema file is selected. The element name is treated as the root element in the uploaded schema file.
Note: Opaque schema will return Base64 encoded string
On the right side of the canvas, click Actions to expand the panel.
Drag the For Each icon to the plus sign where you want to loop over an element.
The For Each dialog is displayed.
Expand the Source tree to select an element.
Drag a repeatable element to the Repeating Element field. This is the element over which to loop.
For this example, the element over which to loop is ICSFile.
Enter a name in the Name field and an optional description of the action in the Description field.
For every iteration of the loop, there is a single reference to the repeating element (ICSFile). A current element name file is required for this action to occur.
Enter an alias for the current file of the iteration in the Current Element Name field.
Map the FileReference of the for-each repeating element (ICSFile) to opaqueElement of StageFileWrite using encodeReferenceToBase64 Function