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
GeorgeTrommelenGeorgeTrommelen 

Bank account validation rule

Can anybody advise me how to make a validation rule for Dutch bank accounts?
 
Bank account validation rule
 
George
jpizzalajpizzala
Can you be more specific?

What about Dutch bank accounts are you trying to validate?  The account number?  Currency formatting?  Etc.?
GeorgeTrommelenGeorgeTrommelen

Hello Justin,

 

Thanks for the reply, it is about the ducht bank account numbers.

 

Regards,

George

jpizzalajpizzala
Ok...how are the bank account numbers supposed to be formatted?  You have to be specific since many people (or maybe just me) are not at all familiar with the ways of Dutch banking.

What is the format of the account number?  How many digits?  Is it alphanumeric?  Are there special characters such as hyphens (-) in it?

Do you have any examples of Dutch bank account numbers (please don't use real accounts, just make it up but keep it in the exact format)?


Message Edited by jpizzala on 06-02-2008 11:42 PM
GeorgeTrommelenGeorgeTrommelen
Hi Justin,
 
I can give you a real life number 34 66 68 700 or 34 68 66 743
 I found this one in Dutch
 
 
function ElfProef(const Banknummer: String): Boolean;
var
 
sFiltered:      String;
  iCount:         Integer;
  iChar:          Integer;
  iValue:         Integer;

begin
 
Result  := False;

  // Controleer minimum lengte
 
if Length(Banknummer) >= 9 then begin
   
// Filter alle niet-getallen
   
SetLength(sFiltered, Length(Banknummer));
    iCount  := 0;

    for iChar := 1 to Length(Banknummer) do
      if
Banknummer[iChar] in ['0'..'9'] then begin
       
Inc(iCount);
        sFiltered[iCount] := Banknummer[iChar];
      end;

    SetLength(sFiltered, iCount);

    // Controleer nieuwe lengte
   
if Length(sFiltered) = 9 then begin
     
iCount  := 0;

      // Tel alle getallen op
      //
      //   Elfproef theorie:
      //      Getal1 * 9 + Getal2 * 8 + Getal3 * 7, enz. moet deelbaar
      //      zijn door 11...
     
for iChar := 1 to Length(sFiltered) do begin
       
iValue  := Ord(sFiltered[iChar]) - Ord('0');
        iCount  := iCount + (iValue * (10 - iChar));
      end;

      // Elfproef
     
if (iCount mod 11) = 0 then
       
Result  := True;
    end;
  end;
end;
 
And:
 
Code

Code:
function ElfProef(const Banknummer: String): Boolean;
var
  sFiltered:      String;
  iCount:         Integer;
  iChar:          Integer;
  iValue:         Integer;

begin
  Result  := False;

  // Controleer minimum lengte
  if Length(Banknummer) >= 9 then begin
    // Filter alle niet-getallen
    SetLength(sFiltered, Length(Banknummer));
    iCount  := 0;

    for iChar := 1 to Length(Banknummer) do
      if Banknummer[iChar] in ['0'..'9'] then begin
        Inc(iCount);
        sFiltered[iCount] := Banknummer[iChar];
      end;

    SetLength(sFiltered, iCount);

    // Controleer nieuwe lengte
    if Length(sFiltered) = 9 then begin
      iCount  := 0;

      // Tel alle getallen op
      //
      //   Elfproef theorie:
      //      Getal1 * 9 + Getal2 * 8 + Getal3 * 7, enz. moet deelbaar
      //      zijn door 11...
      for iChar := 1 to Length(sFiltered) do begin
        iValue  := Ord(sFiltered[iChar]) - Ord('0');
        iCount  := iCount + (iValue * (10 - iChar));
      end;

      // Elfproef
      if (iCount mod 11) = 0 then
        Result  := True;
    end;
  end;
end;
Does this help?
 
George
 
jpizzalajpizzala
I really only need the pattern, but the code is good for reference - so thanks for that.

If the format is always 2 numbers + 1 space + 2 numbers + 1 space + 2 numbers + 1 space + 3 numbers, then you could use the following:

Code:
AND( DutchAccountCode__c <> "" , NOT( REGEX( DutchAccountCode__c , "[0-9]{2}[\\s]{1}[0-9]{2}[\\s]{1}[0-9]{2}[\\s]{1}[0-9]{3}" ) ) )

I'm sure there is a way to shorten the pattern - specifically the 2 numbers + 1 space pattern that occurs 3 times - but maybe someone more familiar with regular expressions will be able to help with that.  :smileyhappy:

HTH

Sravan Kumar MalyalaSravan Kumar Malyala
AND ( NOT ( ISBLANK ( Bank_Account_No__c ) ) , NOT ( REGEX ( Bank_Account_No__c  , "([0-9]{2}[\\s]{1}){3}[0-9]{3}" ) ) )

This can be the shotended form of the code