Accessing FileSets

   

 

There are a number of ways to use the list of files found by a FileSet:

1.Use the FileSet To Variable action to output the list of files to a FinalBuilder variable in the chosen format
2.Use the FileSet directly in script code to iterate the fileset or generate a string containing the files in the fileset, eg. MyFileSet.Count
3.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:

 

To retrieve the count of files in the fileset:

Variable Syntax: %MyFileSet.Count%

Script: MyFileSet.Count

 

To retrieve file 10 in the FileSet:

Variable Syntax: %MyFileSet.File10%

Script: MyFileSet.File10

 

To retrieve file 5 in the FileSet overriding the default quoting to use double quotes:

Variable Syntax: %MyFileSet.File5:quote=double%

Script:        MyFileSet.OutputQuoting = qtDouble

         MyFileSet.File5

 

To retrieve file 5 in the FileSet overriding the default separator:

Variable Syntax: %MyFileSet.File5:sep=comma%

Script:        MyFileSet.OutputSeparator = spComma

         MyFileSet.File5

 

To retrieve all files in the FileSet:

Variable Syntax: %MyFileSet.AllFiles%

Script: MyFileSet.AllFiles

 

To retrieve all files in the FileSet overriding the default separator and quote type:

Variable Syntax: %MyFileSet.File5:quote=single:sep=comma%

Script:        MyFileSet.OutputQuoting = qtSingle

         MyFileSet.OutputSeparator = spComma

         MyFileSet.AllFiles