Skip to main content


         This documentation site is for previous versions. Visit our new documentation site for current releases.      
 

Configuring an activity to access BIX extract files

Updated on April 6, 2022

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.

Before you begin: Prepare your BIX extract files and find the directory in which they reside to determine the activity code.
  1. Place files in your Pega Cloud File Storage repository by running a BIX extraction process.

    For more information about the BIX extraction process, see Creating and running a BIX extract rule.

  2. Create a library with which to integrate a function.
  3. Find the extract file and directory of the extract file in the Pega Cloud File Storage repository by using a repository API.

    Use D_pxListFiles to find the file path and file name of your BIX extract files.

    For more information about using repository APIs, see Repository APIs.

The BIX extraction process for the XML and CSV formats, as well as their manifest files, places the BIX extract files into your Pega Cloud File Storage repository. You do not have direct access to the Pega Cloud File Storage repository but you can pull BIX extract files to a location in your enterprise network by using the Pega Cloud API through an activity.
  1. In the header of Dev Studio, click CreateTechnicalFunction.
  2. In the Label field, enter a name for the rule.
  3. In the Library field, select a library that contains an empty Java directory.
  4. In the Parameters section, enter the following parameter names and Java types:

    Parameters

    NameJava type
    toolsPublicAPI
    repositoryNameString
    filePathString
    fileNameString
  5. Click Create and open.
  6. On the Java tab, in the Compilation status section, select the Function ready to be compiled? check box.
  7. 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)));
    }
    
    
  8. Click Save.
  9. In the header of Dev Studio, click CreateTechnicalActivity.
  10. In the activity rule, enter a label, select an application and the associated ruleset, and then click Create and open.
  11. On the Steps tab, for the first step, enter the following information:
    1. In the Method field, enter Property-Set.
    2. In the Description field, enter Set the file parameters.
    3. Click the Expand icon.
    4. In the Method Parameters section, in the PropertiesName field, enter Param.fullFileName.
    5. In the PropertiesValue field, enter "file://"Param.repositoryName+":"+"/"+Param.fileName.
    6. Click the add row button.
    7. In the PropertiesName field, enter Param.Checkfile.
    8. In the PropertiesValue field, enter Param.filePath+"/"+Param.filename.
    9. Click Jump.
    10. In the resulting window, select the Enable conditions after this action check box.
    11. In the When field, enter @hasMessages(D_pxGetFile[repositoryName:Param.repositoryName,filePath:Param.CheckFile, responseType:"STRING"]).
    12. In the If true list, select Jump to Later Step.
    13. In the True param field, enter DPAGE.
    14. In the If false field, enter Continue Whens.
    15. Click Submit.
  12. For the second step, enter the following information:
    1. In the Method field, enter Java.
    2. In the Description field, enter Java code to download the ZIP file.
    3. Click the Expand icon.
    4. In the PropertiesName field, enter Param.fullFileName.
    5. In the PropertiesValue field, enter "file://"Param.repositoryName+":"+"/"+Param.fileName.
    6. Click the add row button.
    7. In the PropertiesName field, enter Param.GetfilePath.
    8. In the PropertiesValue field, enter Param.filePath+"/"+Param.filename.
    9. Click Jump.
    10. In the resulting window, select the Enable conditions after this action check box.
    11. In the When field, enter hasMessages.
    12. In the If true list, select Jump to Later Step.
    13. In the If false list, select Exit Activity.
    14. Click Submit.
  13. For the third step, enter the following information:
    1. In the Method field, enter Property-Set.
    2. In the Description field, enter Using the function instead of Java step.
    3. Click the Expand icon.
    4. In the PropertiesName field, enter Param.Test.
    5. In the PropertiesValue field, enter the name of the function that you created.
  14. For the fourth step, enter the following information:
    1. In the Method field, enter Show-Page.
    2. In the Step Page field, enter Attachment Page.
    3. In the Description field, enter Show if the Java page has an error.
    4. Click When.
    5. In the resulting window, select the Enable conditions before this action check box.
    6. In the When field, enter Always.
    7. In the If true list, select Continue Whens.
    8. In the If false list, select Skip Step.
    9. Click Submit.
    10. Click Jump.
    11. In the resulting window, select the Enable conditions after this action check box.
    12. In the When field, enter Always.
    13. In the If true field, enter Exit Activity.
    14. In the If false field, enter Continue Whens.
    15. Click Submit.
  15. For the fifth step, enter the followings information:
    1. In the Method field, enter Show-Page.
    2. In the Step Page section, enter D_pxGetFile[repositoryName:Param.repositoryName,filePath:Param.CheckFile, responseType:"STRING".
    3. In the Description field, enter check if file/filepath/repositoryname does not exist.
  16. Click Save.
  17. On the Actions list, select Run.
  18. In the fileName parameter field, enter the name of the extract file.
    The file name should reflect the extract file placed in the repository.
  19. In the filePath parameter field, enter bix/work_BIXFTPListener/completed.
  20. In the repositoryName field, enter pegacloudrepository.
  21. Click Run.
    Result: Your browser opens a new tab and displays a download prompt for your BIX extract file.
  • Previous topic Configuring an FTP listener to access BIX data extracts in Pega Cloud environments
  • Next topic Troubleshooting BIX in Pega Cloud environments

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us