How to limit a field length (of type text)?

erugalatha
Member Posts: 120
Hi,
I have vars defined of type text and I have set their lengths. In code I want to limit the length of text that goes into that field i.e. I do not want to receive the overflow error. How can I limit the length of data that goes into a text variable (and thus into a field)?
Thanks for your help.
I have vars defined of type text and I have set their lengths. In code I want to limit the length of text that goes into that field i.e. I do not want to receive the overflow error. How can I limit the length of data that goes into a text variable (and thus into a field)?
Thanks for your help.
0
Comments
-
I'm assuming these fields are being populated using an outside file.
http://www.mibuso.com/forum/viewtopic.php?t=127850 -
Thanks for reply.
No I am creating a file on disk using the File.WRITE(Line) where the lines within the file have to be of specific length.
The lines are made up of fields from the vendor e.g. sort code for a bank account.
e.g. Sort Code should only ever be 6 chars long so I have defined
a variable of type text that is of length 6. I then take the data from the Vendor."Sort Code" field and put it into my vSortCode variable and add it to my LINE variable. But before I add the vSortCode variable to the LINE I want to check it is only ever 6 chars.
When the LINE has the data I require then I write it out to file.
Thanks.0 -
But it's your field don't you have control on it always being 6 characters?
does it have to be a solid 6 for example if the code is AB1 you need to output 000AB1 or something? Do you have codes that are over 6?
I'm not understanding :-k
COPYSTR
Use this function to copy a substring of any length from a specific position in a string (text or code) to a new string.
NewString := COPYSTR(String, Position [, Length])0 -
Hi,
Not necessarily ... the sort code can be 93-47-98, for example. So I am using DELCHR to remove the - but I am finding that I get an overflow sometimes which means there's data in there that may be over 6 chars long.
If it is I want to raise an error and quit.
Thanks0
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