Hello, I am a young developer end user in an entrepsise which uses Navision (v. FR 2.01). The users wish to have all the fields of phone number in the size(format) "99 99 99 99 99", at the level of tables. What is best method? Thank you.
Benoît Durand
0
Comments
//>> insert - OnValidate() of field "Phone No."
CLEAR(textNewPhoneFormat);
FOR intX := 1 TO 5 DO BEGIN
textNewPhoneFormat := textNewPhoneFormat + COPYSTR("Phone No.",((intX *2)-1),2);
IF intX < 5 THEN
textNewPhoneFormat := textNewPhoneFormat + ' ';
END;
"Phone No." := textNewPhoneFormat;
//<< end insert
If this formatting is to be used in multiple locations in your application, it would be better to use the code in a Codeunit, and call from the table OnValidate() triggers where needed. I would recommend that you test the field for the appropriate number of digits...
intPhoneNoLength := STRLEN("Phone No.");
IF intPhoneNoLength <> 10 THEN
ERROR('Blah blah blahdee blah');
Or some such test as needed. Hope this helps you, please let me know if there is more I can do for you.
Take Care,
Rick
Rick Acton
NCPS, NCDS, NCHRS, NCFAS
High-Tech Consulting Services
5735 Industry Lane, Bldg A, Ste 9
Frederick, MD 21701-7281
301-662-0732 v
301-662-0836 f