1217663 - How to create a Custom Function in Crystal Reports?
- In Crystal Reports, you can write formulas. There is a large array of build in functions that can be used when creating a formula. If there is a formula that is used multiple times on the same report, or used on multiple reports, then it is possible to add it as a function in the report, called: Custom Function.
- Re-use the same formula code;
- Stored in the report file, therefore it does not rely on an external driver like User Function Library (UFL)
- Can be stored in the Repository of SAP BusinessObjects BI Platform, so it can be re-used on other reports.
- Custom Function stored in the Repository can be changed in one place, and all the reports are updated with the new change.
Local NumberVar y := Year(myDate) + 10;
Local NumberVar m := Month(myDate);
Local NumberVar d := Day(MyDate);
- Once you completed writing your code, click on "Save and Close"
- Now, create a new Formula, and use the new function created. For example, the formula will look like:
myFunctionName();
- Save and close the formula.
- Insert the formula on the report to display the value.
- To use the Custom Function on other report, store it in the repository of SAP BusinessObjects BI platfom.
- In Crystal Reports, still with the report open on which you have the Custom Function, go under the menu "Report", select "Formula Workshop. "
- In "Formula Workshop", in the left pane, expand the "Report Custom Functions".
- Right click on the "Custom Function" you created, like: "myFunctionName", and select "Add to Repository. "
- Login to the SAP BusinessObjects Enterprise, and save the Custom Function.
Keywords
FORMULA CUSTOM FUNCTION EXTRACTOR WORKSHOP EXTRACT Crystal Reports Repository Custom functions Use extractor , KBA , BI-RA-CR , How To