For Each File
This activity runs the activities inside it on each file in a collection. Generally, you will want to use this activity with a collection of files attached to a Laserfiche Form (retrieved with the Retrieve Laserfiche Form Content activity). See the tokens this activity produces.
Tip: To bring Laserfiche Forms attachments into Laserfiche, place a Create Entry and an Attach Electronic Document activity inside the For Each File activity, and configure the Attach Electronic Document activity to attach the file currently being processed by the For Each File activity to the entry created by the Create Entry activity. Show me what this looks like.
How does this activity look in the Designer Pane?
- Drag it from the Toolbox Pane and drop it in the Designer Pane.
To configure this activity
Drag and drop activities into this activity.
Select the activity in the Designer Pane to configure the following property boxes in the Properties Pane.
-
Activity Name
Once added to a workflow definition, the default name of an activity can be changed. Providing a custom name for an activity helps you remember the role it plays.
To name an activity
- Add an activity to your workflow by dragging it from the Toolbox Pane and dropping it in the Designer Pane.
- Select the activity in the Designer Pane.
- Under Activity Name in the Properties Pane, replace the default name.
Note: Activity names cannot be the same as any other activity name in the workflow, they cannot be the same as the workflow's name, they must be less than 100 characters, they must contain at least one alphanumeric character, they cannot be "Name," and they cannot be the same as the activity's runtime type (which is usually only an issue with custom activities).
-
Activity Description
Use the Activity Description to provide descriptive text to help you remember the role that the activity plays in the workflow. All activities contain a default description that you can modify while constructing your workflow.
To modify an activity description
- Add an activity to your workflow by dragging it from the Toolbox Pane and dropping it in the Designer Pane.
- Select the activity in the Designer Pane.
- Under Activity Description in the Properties Pane, replace the default description.
-
Files
Use this property box to specify which files the For Each File activity will run on.
To configure files
- Add the For Each File activity to your workflow definition by dragging it from the Toolbox Pane and dropping it in the Designer Pane.
- Select the activity in the Designer Pane.
- Under Files in the Properties Pane, select which type of files you want to run the activity on.
- File Collection: If you want to run the For Each File activity on a file collection, specify a file collection by clicking the Token button (right arrow) . Only folder collection tokens, such as attachments to a Laserfiche Form will appear in this token menu.
- Windows File Directory: To run this activity on a collection of files stored on the Workflow Server machine, specify the file path for the collection. Click the Token button (right arrow) .
- Optional: Select Include subfolders to include the files inside any folders in the file collection.
- Optional: Select Only include files like to only include files that match certain criteria (e.g., to only include XML files you would use *.xml).You can add an asterisk "*" to extend your search term so it includes zero or more unspecified characters and/or a question mark "?" to extend your search term by zero or exactly one character. These are the only two variables allowed in this search. Learn more about this type of search on MSDN.
Note: This activity will not enumerate hidden subfolders, hidden files, or system files.
Note: You must have file browsing enabled in the Workflow Administration Console to browse for a file on the Workflow Server local disk.
Tokens for For Each File
The For Each File activity makes the following tokens, which are available to any activities placed inside it. The For Each File activity runs once per file and each time it runs, the token values below will reflect the information relevant to the file it is currently processing.
Name | Description | Sample Syntax* |
---|---|---|
CurrentFile_MIME Type |
The MIME type of the file. Example: application/xml |
%(ForEachFile_CurrentFile_MIME Type) |
CurrentFile_Path |
The path of the file in its original source location. Example: Collection\Files\1 or C:\myFiles |
%(ForEachFile_CurrentFile_Path) |
CurrentFile_Folder Name |
The name of the folder that the file is in in its original source location. Example: FilesInCollection (LF Forms) or C:\myFiles (Windows) |
%(ForEachFile_CurrentFile_Folder Name) |
CurrentFile_Name |
The name of the file without its extension. Example: MyDocument |
%(ForEachFile_CurrentFile_Name) |
CurrentFile_Extension |
The file's extension. Example: .xml |
%(ForEachFile_CurrentFile_Extension) |
CurrentFile_Full Name |
The name of the file including its extension. Example: MyDocument.xml |
%(ForEachFile_CurrentFile_Full Name) |
CurrentFile_Size |
The size of the file in bytes. Example: 71168 |
%(ForEachFile_CurrentFile_Size) |
CurrentFile_Source ID |
The unique identifier for the file when retrieving it from the file's source. Example: 5 (LF Forms) or C:\myFiles\MyDocument.xml (Windows) |
%(ForEachFile_CurrentFile_Source ID) |
CurrentFile_Source Name |
The name of the file's source (i.e., where the file came from). Example: http://myserver/forms or C:\ or \\computer\C$ |
%(ForEachFile_CurrentFile_Source Name) |
CurrentFile_Category |
The type of the file in its source location. Example: File (Windows) or Attachment (LF Forms) |
%(ForEachFile_CurrentFile_Category) |
CurrentFile | This token is replaced by the current file when the activity runs. This token only appears where file tokens are allowed, such as in the Form Data property of a HTTP Form Post activity. | %(ForEachFile_CurrentFile) |
Iteration | The number of times the For Each File activity has run. | %(ForEachFile_Iteration) |
*The "ForEachFile" portion of the syntax changes to match the activity's name as specified in the Activity Name property box. Note that all non-alphanumeric characters, except underscores, are removed from the name.
Example: If you rename the activity Apply [Settings] to Each, the syntax for the CurrentFile_Source ID token will be %(ApplySettingstoEach_CurrentFile_Source ID).