Sage X3 is a powerful ERP system that helps businesses manage their operations efficiently. One of its key features is its robust reporting capabilities, often powered by Crystal Reports. Crystal Reports allows users to create dynamic, customizable reports to extract meaningful insights from Sage X3 data. A particularly useful feature in Crystal Reports is shared variables, which can significantly enhance the flexibility and functionality of Sage X3 reports. In this blog, we’ll explore the role of shared variables in Crystal Reports and how they can be leveraged to improve Sage X3 reporting.
Recently, we received a requirement from one of our clients to include the Invoicing Element Tax within the main tax summary section located in the footer on the Sales Invoice report.
Typically, to avoid duplication in the main report, we handle Invoicing Elements separately by placing them in a sub-report. In this case, we calculated the Invoicing Element Tax within the sub-report. To include this calculated tax value in the main report’s tax summary at the footer, we used a shared variable. By leveraging the Shared Variable feature in Crystal Reports, we were able to pass the tax value from the sub-report to the main report, ensuring accurate and consolidated tax reporting without duplication.
In Crystal Reports, shared variables serve as a bridge between sub-reports and the main report when standard linking or parameter passing isn’t sufficient to transfer data.
Crystal Reports has three types of variable scope:
- Local – available only within the formula
- Global – accessible across all formulas in the same report
- Shared – accessible across sub-reports and main reports
Step 1: Calculate the Invoicing Element Taxes in a formula field using Shared Variables within the sub-report. We are using Shared Variables here because we need to pass the calculated values from the sub-report to the main report, allowing us to include them in the total tax section of the main report. Refer to the screen below for your reference.
New Stuff: From Generic to Geared: Making Sage X3 Work for Oil & Gas

Step 02: Place the formula (created in Step 1) in the Report Footer section of the sub-report and suppress the section, as we do not want to display the value directly in the sub-report. Since Crystal Reports processes data from top to bottom (header to footer), placing the formula in the footer ensures that if there are multiple detail lines, the values will be summarized correctly at the end of the sub-report. Refer to the screen below for your reference.

Step 03: In the main report, create a new formula field and assign the value of the Shared Variable (declared in the sub-report) to it.

Step 04: In the final step, create a new formula field in the main report to calculate the total tax. In this formula, add the main tax values along with the Shared Variable that holds the Invoicing Element Tax value. Place this formula in the Report Footer section of the main report, as this is where the tax summary calculation should appear.
Refer to the screenshot below for your reference.

In the below screenshot you will get desired output –


By implementing this solution, the report now correctly displayed the Invoicing Element Tax from the sub-report in the summary section of the main report, giving users a complete and accurate view of tax details without navigating between sections. Whether you’re calculating running totals, aggregating data conditionally, or passing values between sub-reports, shared variables can streamline your reporting process and elevate the quality of your Sage X3 reports.
[about_us_blog_common]