Configuring an activity to access BIX extract files
After a Business Intelligence Exchange (BIX) extraction process completes in a Pega Cloud environment, obtain the BIX extract files from your Pega Cloud File Storage repository. You can use an activity to pull the extract files onto your enterprise local storage. The activity can be helpful when the BIX FTP listener encounters an error, a transfer fails, or if you do not subscribe to the Pega SFTP service.
- In the header of Dev Studio, click .
- In the Label field, enter a name for the rule.
- In the Library field, select a library that contains an empty Java directory.
- In the Parameters section, enter the following parameter names and
Java types:
Parameters
Name Java type tools PublicAPI repositoryName String filePath String fileName String - Click Create and open.
- On the Java tab, in the Compilation status section, select the Function ready to be compiled? check box.
- In the Java source field, enter the following code:
String fullFileName: "file://' + repositoryName+ ":" + filePath+ “/"+ fileName; try { HashStringMap aMap = new HashStringMap(); aMap.put("ContentDisposition", "attachment; filename=\"" + fileName * aMap.put("contentType", "application/octet-stream"); PRFile fileloDownload = new PRFile(fullFileName); if(fileToDownload.exists()) { tools.sendFile(fileToDownload, false, aMap, true); oLog.error("pyDownloadZipFile: File exists and sent " + fullFileName); } else { oLog.error("pyDownloadZipFile: Could not download file. File " + fullFileName * " does not exist."); tools.getPrimaryPage().addMessage("DownloadFailedFileDoesntExist"); } } catch (Exception e) { oLog.error("pyDownloadZipFile: Failed to download file" * e.getMessage))); }
- Click Save.
- In the header of Dev Studio, click .
- In the activity rule, enter a label, select an application and the associated ruleset, and then click Create and open.
- On the Steps tab, for the first step, enter the following
information:
- In the Method field, enter Property-Set.
- In the Description field, enter Set the file parameters.
- Click the Expand icon.
- In the Method Parameters section, in the PropertiesName field, enter Param.fullFileName.
- In the PropertiesValue field, enter "file://"Param.repositoryName+":"+"/"+Param.fileName.
- Click the add row button.
- In the PropertiesName field, enter Param.Checkfile.
- In the PropertiesValue field, enter Param.filePath+"/"+Param.filename.
- Click Jump.
- In the resulting window, select the Enable conditions after this action check box.
- In the When field, enter @hasMessages(D_pxGetFile[repositoryName:Param.repositoryName,filePath:Param.CheckFile, responseType:"STRING"]).
- In the If true list, select Jump to Later Step.
- In the True param field, enter DPAGE.
- In the If false field, enter Continue Whens.
- Click Submit.
- For the second step, enter the following information:
- In the Method field, enter Java.
- In the Description field, enter Java code to download the ZIP file.
- Click the Expand icon.
- In the PropertiesName field, enter Param.fullFileName.
- In the PropertiesValue field, enter "file://"Param.repositoryName+":"+"/"+Param.fileName.
- Click the add row button.
- In the PropertiesName field, enter Param.GetfilePath.
- In the PropertiesValue field, enter Param.filePath+"/"+Param.filename.
- Click Jump.
- In the resulting window, select the Enable conditions after this action check box.
- In the When field, enter hasMessages.
- In the If true list, select Jump to Later Step.
- In the If false list, select Exit Activity.
- Click Submit.
- For the third step, enter the following information:
- In the Method field, enter Property-Set.
- In the Description field, enter Using the function instead of Java step.
- Click the Expand icon.
- In the PropertiesName field, enter Param.Test.
- In the PropertiesValue field, enter the name of the function that you created.
- For the fourth step, enter the following information:
- In the Method field, enter Show-Page.
- In the Step Page field, enter Attachment Page.
- In the Description field, enter Show if the Java page has an error.
- Click When.
- In the resulting window, select the Enable conditions before this action check box.
- In the When field, enter Always.
- In the If true list, select Continue Whens.
- In the If false list, select Skip Step.
- Click Submit.
- Click Jump.
- In the resulting window, select the Enable conditions after this action check box.
- In the When field, enter Always.
- In the If true field, enter Exit Activity.
- In the If false field, enter Continue Whens.
- Click Submit.
- For the fifth step, enter the following information:
- In the Method field, enter Show-Page.
- In the Step Page section, enter D_pxGetFile[repositoryName:Param.repositoryName,filePath:Param.CheckFile, responseType:"STRING".
- In the Description field, enter check if file/filepath/repositoryname does not exist.
- Click Save.
- On the Actions list, select Run.
- In the fileName parameter field, enter the name of the extract
file. The file name should reflect the extract file placed in the repository.
- In the filePath parameter field, enter bix/work_BIXFTPListener/completed.
- In the repositoryName field, enter pegacloudrepository.
- Click Run.
Previous topic Configuring an FTP listener to access BIX data extracts in Pega Cloud environments Next topic Troubleshooting BIX in Pega Cloud environments