function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Account Number - Data Check

Hey Guys,


Basically I have two fields.


Account Number & Account Number Backwards.


The reason behind this is to make sure there is no human error when entering the account number by reversing the number and checking for a match.


My problem is I can't seem to find anywhere, a way to reverse this back to check its equal!




Account Number: 123456

Backwards: 654321

Match: Account Number = Reverse(654321)


As a quick example.


Has anyone thought of something simliar ? Or a better way of storing clients bank account details within the system?






If the Account Number is fixed length (always) you could use a validation rule with something like:


MID(fieldA, 1, 1) != MID(fieldB, 6, 1) ||
MID(fieldA, 2, 1) != MID(fieldB, 5, 1) ||
MID(fieldA, 3, 1) != MID(fieldB, 4, 1) ||
MID(fieldA, 4, 1) != MID(fieldB, 3, 1) ||
MID(fieldA, 5, 1) != MID(fieldB, 2, 1) ||
MID(fieldA, 6, 1) != MID(fieldB, 1, 1)

 Be careful to check if MID() starts at 0 or 1 though!


Otherwise you'll need to use Apex to iterate through the string characters


Hey Richie88


Where are you trying to attempt this?


Apex actually has a string method to get the reverse. For example:


String myString1 = 'abcde';
String myString2 = 'edcba';
Booleen result = 
   (myString1 == myString2.reverse);

 You could put something like this in a trigger, controller, extension or even some javascript.