Validating a field

Freaky
Member Posts: 125
Hi Guys,
I posted a similar question some time and now I want it in a different way. I have this field called "Employee No." on a form called the Employee card. I want a validation such that I only want to insert 7 digits and the first digit must not be greater than 3. If the number is less than or greater than 7. I will have an error message and if the first digit of the 7 digits is greater than 3 an error message also. Please I just need the codes on how to do this.
Thanks in advance.
I posted a similar question some time and now I want it in a different way. I have this field called "Employee No." on a form called the Employee card. I want a validation such that I only want to insert 7 digits and the first digit must not be greater than 3. If the number is less than or greater than 7. I will have an error message and if the first digit of the 7 digits is greater than 3 an error message also. Please I just need the codes on how to do this.
Thanks in advance.
0
Comments
-
Just to be clear..
1)"Employee No" is type code correct
2)you want a seven digit Employee No.
3)the first digit must be 0,1,2,3
is this correct?
How about on validate of the employy no field...
OnValidate()IF STRLEN("Employee No.") <> 7 THEN ERROR('Employee No. Must Have 7 Digits'); IF COPYSTR("Employee No.",1,1) IN ['4','5','6','7','8','9'] THEN ERROR('First Digit Of Employee No. Must Not Be Greater Than 3');
I bet there will be alternate codes
Here's the link to your other post
viewtopic.php?f=23&t=282510 -
Thank you.. That worked.. Now i want to add new validation. The Length of the field as usual is 7. I want to check within the filed if there is any alphabet it rejects it and display the message it cannot take alphabet. How best can i do this?0
-
I'm at home now so I can't check but i believe if you look at the properties of the field there should be one called CharsAllowed or something like that - fill that with 01234567890
-
Thanks Savatage that really helped.0
-
Yeah works like a charm that charsAllowed
_ if you edit your first post you can change the attribute on top to SOLVED.
0 -
Try this:
Pos := 0 ; REPEAT Pos := Pos + 1 ; IF COPYSTR("Employee No.",Pos,1) IN['A'..'Z'] THEN ERROR('Only numbers allowed"') ; UNTIL Pos > STRLEN("Employee No.")
0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions