Validate only the first character of field in Navision.

kolaboykolaboy Member Posts: 446
Hi Experts,

if "Account No." <> '' then
if not ("Account No."[1] in ) then
Error(TextXXX);

This is currently working with first Characters with A or B. But after typing the first Character with A Or B, it allows other letters to follow.

What i want in addition to this is to let it accept only the Letters A or B as first letters then followed by four digit Numbers. It should not allow anyother letter apart from A or B and They should not be repeated. Only A and four digit nos or B and Four digit nos.
The Nos. too should not exceed four digits. What modification can one do on the above code?
Any idea on this.

Comments

  • David_CoxDavid_Cox Member Posts: 509
    Hmmm! easy!
    i = variable Integer
    IF "Account No." <> '' THEN 
       IF (STRLEN("Account No.") <> 5) OR 
          NOT(EVALUATE(i,COPYSTR("Account No.",2))OR
          NOT("Account No."[1] in ['A','B']) THEN   
       ERROR(TextXXX); 
    

    :D
    Analyst Developer with over 17 years Navision, Contract Status - Busy
    Mobile: +44(0)7854 842801
    Email: david.cox@adeptris.com
    Twitter: https://twitter.com/Adeptris
    Website: http://www.adeptris.com
  • kolaboykolaboy Member Posts: 446
    Hi David,
    Thanks you very much. It has worked. \:D/
  • kolaboykolaboy Member Posts: 446
    Hi David,
    Thanks you very much. It has worked. \:D/

    David can you look at the post topic for me and see if you can help me solve that last problem. the topic is :How to count No. of Months.
    Please.
    thanks.
Sign In or Register to comment.