Converting data types: Date, Integer

prassl
Member Posts: 24
Good morning everybody,
I would please need your help to sort out a little problem:
I am automatically generating file names in NAV 4.0 for external files which should look like this:
Date_SeqNR_Name.Extension e.g. 20060426_01_Test.txt
Problem is: I cannot combine the string-parts as Date is Type Date, SeqNr is Type Integer and Name + Extension are Strings. (Text)
Is there any way of converting data types in C/AL ? Like the parsing e.g. in Java ?
sorry, maybe my question is really simple, but I couldn t find a solution for it yet...
many thanks in advance
cheers,
mp
I would please need your help to sort out a little problem:
I am automatically generating file names in NAV 4.0 for external files which should look like this:
Date_SeqNR_Name.Extension e.g. 20060426_01_Test.txt
Problem is: I cannot combine the string-parts as Date is Type Date, SeqNr is Type Integer and Name + Extension are Strings. (Text)
Is there any way of converting data types in C/AL ? Like the parsing e.g. in Java ?
sorry, maybe my question is really simple, but I couldn t find a solution for it yet...
many thanks in advance
cheers,
mp

... I am not a programmer, I just write code.
0
Answers
-
Better is to decompose the date using the fct DATE2DMY() . See the online help for detail.
Withe that fct, you could make something like :
FileName := STRSUBSTNO('%1%2%3_ .......',DATE2DMY(WORKDATE,3),
DATE2DMY(WORKDATE,2),
..... );0 -
Look for the FORMAT ( Number into Text ) and the EVALUATE(Text into Number) functions in the C/SIDE online helpKai Kowalewski0
-
Try this, it is a way of formatting dates how you want them
// MyStr := FORMAT(TODAY,0,'<Day,2><Month,2><Year,2>');
// MESSAGE(FORMAT(TODAY,0,'<Day,2><Month,2><Year,2>'));
If you need to add a special space character say underscore you can use it like this
// MyStr := FORMAT(TODAY,0,'<Day,2>_<Month,2>_<Year,2>');
So yours would be
MyStr := STRSUBSTNO('%1_ %2_%3.txt',FORMAT(TODAY,0,'<Year,4><Month,2><Day,2>'),FileCounter,Filename);
Giving 20060427_1_Myfile.txtAnalyst 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.com0 -
problem solved the way HalMdy and David Cox suggested
works fine \:D/
thank you so much !
cheers, manu... I am not a programmer, I just write code.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