Overflow exeption when you put together string and integer
bRahms
Member Posts: 44
I admit, we're complete beginners with Navision. But you can hardly find information on the internet, so i hope you guys can sort this out.
We would like to put an Integer + an Text field together in one String, but we keep on getting Overflow execeptions when converting Text to Text.
We would like to put an Integer + an Text field together in one String, but we keep on getting Overflow execeptions when converting Text to Text.
recRegio.RESET;
recRegio.SETCURRENTKEY(recRegio.RegioID);
recRegio.SETFILTER(recRegio.RegioID, '=%1',recRegio.RegioID);
IF recRegio.FIND('-') THEN
BEGIN
dossiernr := recRegio.RegioAfkorting+'/'+recDossier2.Dossiernr+'/2007';
recRegio.RegioAfkorting := dossiernr;
END
0
Comments
-
make sure the field size of dossiernr is greater than the field size of text + field size of integer.
Example: text field - size 10, integer (can be any lenght) so size of dossiernr should be 30 atleast.
also size of recRegio.RegioAfkorting
I hope recRegio.RegioAfkorting and dossiernr are text fieldsLR0 -
We figured it out now, Thank you!0
-
As you can see we use 2007 now, but we want to filter the year from the date.. but how? 8-[0
-
Are dossiernr and recRegio.RegioAfkorting date fields?
u want to setfilter using SETFILTER or SETRANGE???
or do u want the year from date [ syntax is (Date, 3) which gives year from the date]LR0 -
They are textfields.
The thing we want is:
We want to create a unique number that consists of:
First letter of the chosen region above (that's ok) + unique number of three digits + the year that the file has been posted.
So for example: Today we make a new file in the Region: Brussels
-> BR/001/2007
Our problem is that we don't know how to filter the year out of the date and put it into this string.0 -
ok the syntax is
dossiernr := recRegio.RegioAfkorting+'/'+recDossier2.Dossiernr+
FORMAT(DATE2DMY(WORKDATE,3));
DATE2DMY(WORKDATE,3) - Returns year in integer format. so you need to change it into text using FORMAT functionLR0 -
As you can read from previous posts:
Year := date2dmy(anydate, 3);
and your code will be the next
dossiernr := recRegio.RegioAfkorting+'/'+recDossier2.Dossiernr+'/'+format(date2dmy(workdate, 3))
and your "dossiernr" variable must be declared to accept the longest code you can obtain.0 -
Thank you very much. Glad you don't insult me for being a newbie in Navision [-o<
Next up: The dossiernumber has to be the last one in the database (001) + 1. I'll try for myself, but any help is welcome
0 -
i will leave this to you to try for couple of hours , if yo ustill cna't then help will be on its way.LR0
-
I think it has something to do with EVALUATE, but then it says i can't do +1, because it's a boolean.:
numDossiernr := EVALUATE(Int, FORMAT(recDossier2.Dossiernr));
then i want to do numDossiernr+1, but now it's a boolean, not an int.. :-k0 -
When you use EVALUATE the value that gets returned is whether or not the conversion succeeded.
The first parameter that gets passed to EVALUATE actually holds the converted value.
So in your case:
numDossiernr holds the value that determines whether the call to EVALUATE succeeded or failed.
Int holds the converted value of recDossier2.DossiernrThis isn't a signature, I type this at the bottom of every message0 -
Thanks again, with the format(Int+1) it worked out fine. But now it sais BR/8/2007 and that should be BR/008/2007. Same as the next documents then, it should be BR/010/2007 and not BR/10/2007. Is this possible?
... I've read that's better to start with 100?0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 611 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions