error telebank import bank statement

nightrodnightrod Member Posts: 68
Hi,

when importing a bank statement using the

i got this message:
The value of COPYSTR parameter 2 is outside of the permitted range.
The current value is:0.
The permitted range is: from 1 to 2147483647.

using debugger i can see which line it is and where it stops.
everything looks normal.
anyone got an idea?

Comments

  • kinekine Member Posts: 12,562
    Can you post the line of code? It seems that the second parameter is some expression like STRPOS searching for some char but the char is not in the value, thus returning 0...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • nightrodnightrod Member Posts: 68
    AccountNo := Acc;
    IF "Country Code"<>'' THEN
      EXIT(TRUE);
    Acc := CharacterFilter(UPPERCASE(Acc),Text1000031);
    BaseLen := STRLEN(Acc);
    IF (STRPOS(Acc, Text1000032) = 1) OR
       (STRPOS(Acc, Text1000033) = 1)
    THEN BEGIN
      FirstCharacter := Acc[1];
      Acc := CharacterFilter(Acc,'0123456789');
      IF BaseLen <> STRLEN(Acc)+1 THEN
        EXIT(FALSE);
      Len := STRLEN(Acc);
      IF (Len < 1) OR (Len > 7) THEN
        EXIT(FALSE);
      IF Len = 1 THEN
        IF Acc[1] = '0' THEN
          EXIT(FALSE);
      CLEAR(AccountNo);
      AccountNo[1] := FirstCharacter;
      AccountNo := AccountNo + Acc;
      EXIT(TRUE);
    END;
    
    Acc := DELCHR(Acc,'=',Text1000034);
    CASE STRLEN(Acc) OF
      9:Acc:='00'+Acc;
     10:Acc:=COPYSTR(Acc,1,1)+Acc;
     ELSE EXIT(FALSE)
    END;
    Res := (STRCHECKSUM(Acc,'55987654321',11)=0);
    IF Res THEN
     AccountNo := COPYSTR(Acc,12-BaseLen);// the error is here. BaseLen = 12 so 12-12 is zero.
    
  • danlindstromdanlindstrom Member Posts: 130
    Hi

    Whats the value of Acc & Text1000031?
    What kind of fileformat from the bank are you receiving?

    It seems that either the file is corrupt or tha value of Acc are note parsed correctly
    Regards
    Dan Lindström
    NCSD Navision 2.00 since 1999 (Navision Certified Solution Developer)
    MBSP Developer for Microsoft Dynamics NAV 2009
  • nightrodnightrod Member Posts: 68
    its a Swift MT940 protocoll.
    the file doesnt look corrupt.
  • kinekine Member Posts: 12,562
    It looks like
    IF (STRPOS(Acc, Text1000032) = 1) OR
       (STRPOS(Acc, Text1000033) = 1)
    

    is FALSE, thus skipping this branch and because
    BaseLen := STRLEN(Acc);
    
    you have error in your last line... check, if really the Text1000032/33 are at first position in the Acc, may be there is some space or something before them, or there is CASE-SENSITIVE problem...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.