There are a number of ways to use the list of files found by a FileSet:
- Use the FileSet To Variable action to output the list of files to a FinalBuilder variable in the chosen format
- Use the FileSet directly in script code to iterate the fileset or generate a string containing the files in the fileset, eg. MyFileSet.Count
- Use the FileSet directly in fields of FinalBuilder actions using the variable syntax, eg. %MyFileSet.File1%
Methods of a FileSet
The methods of a FileSet can be accessed in both script and via the variable syntax in the fields of actions using the following syntax:
- Count - returns the amount (integer) of files in the FileList
- IsEmpty - returns true or false (boolean) depending if any files are in the FileSet
- File<index> - returns the filename (string) specified by the index. The index specified is zero based (ie. first file in fileset is index 0) and must be less than the total amount of files in the FileSet.
- AllFiles - returns all the files (string) in the FileSet
If accessing the FileSet using the variable syntax, the following parameters are also available:
:quote=[double|single]
Specifying the quote type overrides the default quote type as specified in the FileSet Define action. Can be appended to both the File and AllFiles methods
:sep=[crlf|cr|lf|comma|space|tab|colon|semicolon]
Specifying the separator type overrides the default separator character as specified in the FileSet Define action. Can be appended to the AllFiles method.
Examples
Count
To retrieve the count of files in the fileset:
Variable Syntax | Script |
---|---|
%MyFileSet.Count% | MyFileSet.Count |
File X
To retrieve file 10 in the FileSet:
Variable Syntax | Script |
---|---|
%MyFileSet.File10% | MyFileSet.File10 |
File X with quoting
To retrieve file 5 in the FileSet overriding the default quoting to use double quotes:
Variable Syntax | Script |
---|---|
%MyFileSet.File5:quote=double% | MyFileSet.OutputQuoting = qtDouble MyFileSet.File5 |
File X with seperator
To retrieve file 5 in the FileSet overriding the default separator:
Variable Syntax | Script |
---|---|
%MyFileSet.File5:sep=comma% | MyFileSet.OutputSeparator = spComma MyFileSet.File5 |
All files
To retrieve all files in the FileSet:
Variable Syntax | Script |
---|---|
%MyFileSet.AllFiles% | MyFileSet.AllFiles |
All files with quotation and separator
To retrieve all files in the FileSet overriding the default separator and quote type:
Variable Syntax | Script |
---|---|
%MyFileSet.File5:quote=single:sep=comma% | MyFileSet.OutputQuoting = qtSingle MyFileSet.OutputSeparator = spComma MyFileSet.AllFiles |