How to Rename Your Exported Crystal Reports Dynamically in Sage X3

By | February 27, 2025

Crystal Reports is a powerful tool that allows users to create customized reports from various data sources. With features like formulas, cross-tab reports, sub-reports, special fields, and conditional formatting, it’s no surprise that Sage X3 supports Crystal Reports to export ERP data as needed.

In this blog, we will guide you through the process of how we helped a client achieve a customized file name for their exported report. Instead of using a predefined report name, the client wanted the exported file name to include the project code and the date of export.

The Scenario: Job Cost Report Customization

For one of our clients, we created a Job Cost Report that provides detailed project information, including:

Project code
Tasks and subtasks
Committed and actual prices

The Requirement: Custom Exported File Name

The client wanted to modify the exported file name so that it would include the Project Code and the Export Date, rather than the default report name.

We were able to achieve this requirement by modifying the exported file name using 4GL script. Here’s how we did it.

How We Achieved the Client’s Requirement

We used a combination of an entry point, the AIMP3 standard script, and a ZAIMP3 specific script to assign a dynamic file name during the report export process. The following sections will walk you through the steps involved:

Step 1: Entry Point with AIMP3 Standard Script

We began by setting up an entry point with the AIMP3 standard script. This entry point is critical for ensuring the customized script runs during the report’s generation process.

New Stuff:- How to Show Multi-Line Text in Sage X3

Fig 1: Entry point with AIMP3 standard script
Fig 1: Entry point with AIMP3 standard script

Step 2: Assigning a Dynamic File Name Using ZAIMP3 Script

In the ZAIMP3 specific script, we wrote the logic to assign a dynamic file name. This logic uses the FICHIER global variable and is executed during the IMPRIME and REPORT actions of the script.

1.IMPRIME Action: The logic here assigns the dynamic file name to the FICHIER global variable and stores the file on the server path.

2.REPORT Action: The script retrieves the report from the server path and sends it to the application for export.

Step 3: Modify Report Code Destination

The AIMP3 entry point triggers while printing the report. Therefore, we needed to modify the report’s destination settings.

Fig 2: Report code with destination settings
Fig 2: Report code with destination settings
Fig 3: Destination with output type set to FILE
Fig 3: Destination with output type set to FILE

Conclusion
By following the above steps and modifying the script logic, we successfully achieved the client’s requirement of dynamically naming the exported report file. The client’s exported report file now includes the Project Code and Export Date, making the process more efficient and user-friendly.

About Us

Greytrix – a globally recognized and one of the oldest Sage Development Partners is a one-stop solution provider for Sage ERP and Sage CRM organizational needs. Being acknowledged and rewarded for multi-man years of experience and expertise, we bring complete end-to-end assistance for your technical consultations, product customizations, data migration, system integrations, third-party add-on development, and implementation competence.

Greytrix has some unique integration solutions developed for Sage CRM with Sage ERPs namely Sage X3Sage IntacctSage 100Sage 500, and Sage 300. We also offer best-in-class Sage ERP and Sage CRM customization and development services to Business Partners, End Users, and Sage PSG worldwide. Greytrix helps in the migration of Sage CRM from Salesforce | ACT! | SalesLogix | Goldmine | Sugar CRM | Maximizer. Our Sage CRM Product Suite includes addons like  Greytrix Business Manager, Sage CRM Project Manager, Sage CRM Resource Planner, Sage CRM Contract Manager, Sage CRM Event Manager, Sage CRM Budget Planner, Gmail Integration, Sage CRM Mobile Service Signature, Sage CRM CTI Framework.

Greytrix is a recognized Sage Champion Partner for GUMU™ Sage X3 – Sage CRM integration listed on Sage Marketplace and Sage CRM – Sage Intacct integration listed on Sage Intacct Marketplace. The GUMU™ Cloud framework by Greytrix forms the backbone of cloud integrations that are managed in real-time for the processing and execution of application programs at the click of a button.

For more information on our integration solutions, please contact us at sage@greytrix.com. We will be glad to assist you.