Summary
Hash total calculation for bank account number doesn't work as expected
Content
Hi All,
I have a EFT payment template where one of the requirement is a field to display a hash total calculation of the bank account number. It has to be the 10 rightmost digits :
How to calculate:
- Repeat Steps 1-3 for each transaction:
- Step 1: Get Receiving Bank Account Number (P41.5) field value.
- Step 2: Remove characters to right of 15 leftmost characters.
- Step 3: Convert to number. Replace any non-numeric character with 1.
- Step 4: Add up all numbers from Step 3.
- Step 5: Remove characters to left of 10 rightmost digits.
If value is shorter than 10 digits, add leading zeros.
Here is my function which doesn't return the required value:
SUBSTR ( LPAD ( TO_CHAR ( SUM ( TO_NUMBER ( (TRANSLATE ( LOWER ( substr(to_char(OutboundPayment/ PayeeBankAccount/ BankAccountNumber),1, 15) ), 'abcdefghijklmnopqrstuvwxyz', '11111111111111111111111111'))))), 50, '0'), 41)
Attaching the template and XML data for your information. It's the field P80_RECORD from position 49 to 58.
Any ideas where i'm wrong? Should be something obvious but i just can't get this working.
Thanks in advance,
Alex