Use the Connect-File method to invoke a Connect File rule (Rule-File-Connect rule type). The rule can create, add contents to, or close an output file.
Parameters
This method has three parameters:
Parameter
|
Description
|
ConnectorName
|
Enter the Connector Name (second key part) of a Connect File rule, an instance of the Rule-Connect-File rule type. The system uses the class of the step page as the first key part of the rule.
|
Operation
|
Select to identify the source of output to be added to the file.
Write from HTML Stream Rule — An HTML rule.
Write from XML Stream Rule — An XML Stream rule.
Write from eForm — A Map eForm rule
Work Attachment — A work item attachment
Write from Clipboard Property — The value of a single property.
Write from Map Structured rule — The output data structure produced by a map structured rule.
Close File — No further output; close the file. (This is meaningful and necessary only when the Keep File Open check box is selected on a Connect File rule.
|
Parameter
|
Identify the key of the Operation parameter.
Identify the property, key of the rule, or key of the work item attachment designated in the Operation field.
- For
Clipboard Property , enter a property reference, literal text, parameter, local variable, or complex function. Literal text must be surrounded by double quotes.
- For
HTML Stream rules , XML Stream rules , or Write from Map Structured rule, enter the second key part of the rule. The system uses the class of the step page (or the class of the activity) with rule resolution to find the rule. (For XML Stream rules, the third key part must be MapFrom.)
- For
eform rules , enter a valid Code-Pega-eForm page. Ensure that the pyEform property of this page contains the PDF content, in the form of a byte array.
- For
Work Attachment , enter the name of a valid page of class Data-WorkAttach-File.
- Leave blank if the Operation parameter is
Close File .
|
Results
The Connect-File method works as follows:
- Using rule resolution, locates the Connect File rule.
- Uses information in the Service tab of the rule to identify the path and file name of the output file, and processing instructions
- Locates the rule or other object identified by the Operation and Parameter.
- Opens the file if not already open, and appends the output.
- Generates the output using stream processing, map eform processing or map structured processing, if specified. If the map structured rule specifies a character encoding other than
Default
, output characters are converted to the specified character set using normal Java methods.
- Closes the file, unless the Keep File open option on the Connect File rule is selected.
- Updates the value on the clipboard of the status and status message properties identified in the rule.
If the Operation is Close File,
steps 5 and 6 do not occur and the output file is closed.
Operation of this method is synchronous. Further processing in the activity does not resume until the file processing completes.
Checking the method status
This method updates the pxMethodStatus property. See How to test method results using a transition.
Example
For an example using this method, see the PDN article How to write a file to the local file system using a file connector.
Methods and instructions by function
Open topic with navigation