Child pages
  • File Exist Trigger

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Flow Context VariableFieldJava TypeDescriptionPrescript / Postscript Example
RESULTurl_string_matchesList<String>

Contains URLs of files against which the file trigger matched using its file criteria. This field contains the same information as the "url_object_matches" field but in string form.

This result property is a collection (even if only one file is found, the result property will be a collection containing a single value). This means that in order to access the individual URL strings returned by the File Exist Trigger, you must use a For Each Collection Element Action to step through the items one at a time.

To set up the For Each Collection Element Action, just add a flow from the File Exist Trigger to the For Each Collection Element Action. Add a runtime data map to this flow with a flow context source set to "RESULT.url_string_matches" (which tells Flux "retrieve the collection stored in the url_string_matches result property"), and an action property target of "Collection". The individual URL strings can then be accessed using normal techniques for the For Each Collection Element Action.

If you are confident that your collection contains only a single value, you can access that value directly using variable substitution:

Panel

${RESULT.url_string_matches.get(0)}

This will allow you to bypass the For Each Collection Element Action and directly use the URL string in a subsequent trigger or action.

Code Block
languagejava
List urlStrings = flowContext.get("RESULT").url_string_matches;

for (String fileUrl : urlStrings) {
   System.out.println("Found: " + fileUrl);
}
RESULTurl_object_matchesList<URL>

Contains URLs of files against which the file trigger matched using its file criteria. This field contains the same information as the "url_string_matches" field but in URL object form.

Code Block
languagejava
List urlObjects = flowContext.get("RESULT").url_object_matches;

for (URL fileUrl : urlObjects) {
   System.out.println("Found: " + fileUrl);
}
RESULTfileinfo_matchesList<flux.file.FileInfo>

Contains details about files against which the file trigger matched using its file criteria. Details include file size, last modified date, and file permissions.

This result property is a collection (even if only one file is found, the result property will be a collection containing a single value). This means that in order to access the individual File Infos returned by the File Exist Trigger, you must use a For Each Collection Element Action to step through the items one at a time.

To set up the For Each Collection Element Action, just add a flow from the File Exist Trigger to the For Each Collection Element Action. Add a runtime data map to this flow with a flow context source set to "RESULT.fileinfo_matches" (which tells Flux "retrieve the collection stored in the fileinfo_matches result property"), and an action property target of "Collection".

If you are confident that your collection contains only a single value, you can access that value directly using variable substitution:

Panel

${RESULT.fileinfo_matches.get(0).filename}
${RESULT.fileinfo_matches.get(0).size}
${RESULT.fileinfo_matches.get(0).url}

This will allow you to bypass the For Each Collection Element Action and directly use the File Info properties in a subsequent trigger or action.

See "Using File Infos" below for more information on file info objects.

Code Block
languagejava
List fileInfos = flowContext.get("RESULT").fileinfo_matches;

for (FileInfo fileInfo : fileInfos) {
   System.out.println("Found: " + fileInfo.filename);
}

 

 

When pulling the info after passing it to a For Each Collection Element action use:

Code Block
Complete FileInfo Object = ${i} 
Filename = ${i.filename}   
Path to file = ${i.parent}  
Is Readable = ${i.read?string("yes","no")} 
Is Writable = ${i.read?string("yes","no")}  
Last Modified = ${i.lastModified?datetime}
size = ${i.size}
url = ${i.url}

Output:

Code Block
Complete FileInfo Object = FileInfo (read=true, write=true, filename='temp.xxx', lastModified=Sat Oct 18 18:18:47 CDT 2014, parent='c:\', size=27, url=file:/c:/temp.xxx) 
Filename = temp.xxx   
Path to file = c:\  
Is Readable = yes 
Is Writable = yes  
Last Modified = Oct 18, 2014 6:18:47 PM
size = 27
url = file:/c:/temp.xxx
RESULTfilename_matchesList<String>

Contains simple, base file names, without path information, of files against which the file trigger matched using its file criteria.

This result property is a collection (even if only one file is found, the result property will be a collection containing a single value). This means that in order to access the individual filenames returned by the File Exist Trigger, you must use a For Each Collection Element Action to step through the items one at a time.

To set up the For Each Collection Element Action, just add a flow from the File Exist Trigger to the For Each Collection Element Action. Add a runtime data map to this flow with a flow context source set to "RESULT.filename_matches" (which tells Flux "retrieve the collection stored in the filename_matches result property"), and an action property target of "Collection". The individual filenames can then be accessed using normal techniques for the For Each Collection Element Action.

If you are confident that your collection contains only a single value, you can access that value directly using variable substitution:

Panel

${RESULT.filename_matches.get(0)}

This will allow you to bypass the For Each Collection Element Action and directly use the filename in a subsequent trigger or action.

Code Block
languagejava
List filenames = flowContext.get("RESULT").filename_matches;

for (String fileUrl : filenames) {
   System.out.println("Found: " + fileUrl);
}

...

To set the collection for a For Each Collection Element Action, add the following data map on the flow going into the For Each action:

...