This article has been archived. It is offered "as is" and will no longer be updated.
Within Customer Maintenance Options (Cards | Sales | Customer | Options) there is a Credit Card Number field. I want this field to print on a report, however I want it to create a mask for it. I want only the last 4 digits of the credit card to appear. In place of the prior 12 digits I want an X to appear (XXXX XXXX XXXX 1234).
Create a calculated field in Report Writer using the following steps. Keep in mind that the original report or the custom report will need to use the RM Customer MSTR table.
1. Within Report Writer (Tools | Customize), select the report that is using the RM Customer MSTR table.
2. With the Layout area, go to the Toolbox area and select Calculated Fields, then New.
3. Name the Calculated Field Credit Card #
4. The Result Type should be String, and the Expression Type Conditional.
5. For the Conditional expression choose the Fields tab. Choose RM Customer MSTR for Resource. For Field choose Credit Card Number. Then choose Add.
6. In the Operators sections choose <>.
7. Choose the Constants tab. The Type should be String, leave the Constant box empty. Choose Add. The Conditional expression should appear as:
RM_Customer_MSTR.Credit Card Number <> ""
8. Click in the True Case area of the Expression.
9. Under the Constants tab, choose String for Type. For Constant type in XXXX XXXX XXXX and then choose Add.
10. In the Operators Section choose CAT.
11. Choose the Functions tab and mark User-Defined. For Core choose System, for Function choose RW_Right. Choose Add.
12. Under the Fields tab choose RM Customer MSTR for Resources and Credit Card Number for Field. Choose Add.
13. Under the Constants tab choose Integer for Type and 4 for Constant. Choose Add. The True Case should appear as:
14. Click in the False Case area of the Expression.
15. Under the Constants tab choose Integer for Type, leave the Constant box blank, then Add. The False Case should appear as: ""
16. Choose OK to save the calculated field. You can place this field where you want in your Layout.
17. Save your report. If the change was made to an original report, be sure to go to Security Setup (Setup | System | Security) and grant access to the modified report.
Note - This calculated expression assumes that your mask should be XXXX XXXX XXXX 1234. If you need a different mask, you can change step 9 above. You can configure your Constant in the desired manner.