Crystal report is an application used to create custom reports from a various of data sources. It includes major features such as formulas, cross-tab reports, sub-reports , special fields and conditional formatting etc.
In Sage X3 recently we had an requirement that one of our client wants the hardcoded declaration based on supplier type and date conditions in sales invoice print report. We can achieve this requirement by using the cdate() function in crystal report formula fields.
cdate() Function – The cdate function converts a valid date and time expression to type date , and returns the result.
To achieve the above requirement follow the below steps:
Step 1: Open the sales invoice report in Crystal Reports and create a new formula named ‘Declaration’. This will make it easier to identify the formula when handling the declaration part. Please refer to the screenshot below for your reference.
New Stuff: Mass update price list using a tag instead of updating line wise through standard template.
Step 2: Create a formula in the Formula Wizard based on your date condition and other criteria. Then, add the text that you want to include in the report.
For example, in the screenshot below, we’ve created a formula by adding the hardcoded text ‘Sample Text Declaration for Sales Invoice Report.’ We’ve also included the date condition : this declaration will print after October1,2023.Additionally there’s another declaration, ‘Sample Declaration for Sales Invoice Report before October1,2023,’which will print before 01 oct 2023,as shown in below figure.
Step 3: Save the formula and placed it in report where you require . Save the report and print .
Step 4: In below screenshot you will get desired output .
Additionally, you can supress the dummy date that may be generated in the report for any date field by using the cDate function.
To achieve this,right – click on the date field, select the ‘Format Field’ option in the ‘Commmon’ tab, and add the condition to supress the field. For reference, please check the below screenshot.
In this way, we can restrict the text based on date condition by using the cdate() function in Sales invoice report by following simple steps in crystal report as mentioned in this blog.