Fixed File Format
dohertyk
Member Posts: 94
I've got all the data I need now to great my Trade File and it's all in there, but I am supposed to be writting the file usings a fixed field format.
So...
at Position 3 Cust Num
at Position 21 Cust Name
at Position 50 Cust Phone
at Position 100 Past Due Balances
certainly I have several things between, all of these fields. And I am sure it would probably have been easier has a DataPort.. (which it was), And I am sure it's easier as a tab delimited file, or a comma seperated file.
But Alas, those would all be too easy.. and thus too easy to allow me to write it out that way. Instead I need to put everything into columns.
StartPos & Width are used for DataPorts.
and I couldn't find a way of maybe placing text at specific points into a different text variable and then writing that to the file.
If you have any tips or tricks.. Let me know, it would be very much appreciated.
Thanks in advance,
Kevin
So...
at Position 3 Cust Num
at Position 21 Cust Name
at Position 50 Cust Phone
at Position 100 Past Due Balances
certainly I have several things between, all of these fields. And I am sure it would probably have been easier has a DataPort.. (which it was), And I am sure it's easier as a tab delimited file, or a comma seperated file.
But Alas, those would all be too easy.. and thus too easy to allow me to write it out that way. Instead I need to put everything into columns.
StartPos & Width are used for DataPorts.
and I couldn't find a way of maybe placing text at specific points into a different text variable and then writing that to the file.
If you have any tips or tricks.. Let me know, it would be very much appreciated.
Thanks in advance,
Kevin
0
Answers
-
Next time you should specify all your requirments right from the start.
First it was about getting to current/30/60/90
then it was about a dataport
then about using the aging report
to outstreaming to a txt file and now
fixed lengths.


Look at PADSTR in the c/side help
PADSTR
Use this function to change the length of a string to a length you define. The system does this by either truncating the string or adding filler characters at the end of the string.
NewString := PADSTR(String, Length [, FillCharacter])
Good Luck!0 -
Savatage wrote:Next time you should specify all your requirments right from the start.
First it was about getting to current/30/60/90
then it was about a dataport
then about using the aging report
to outstreaming to a txt file and now
fixed lengths.


Look at PADSTR in the c/side help
PADSTR
Use this function to change the length of a string to a length you define. The system does this by either truncating the string or adding filler characters at the end of the string.
NewString := PADSTR(String, Length [, FillCharacter])
Good Luck!
Thanks Savatage, but is there not an easier way? I had looked at PadStr, it's what I used to put the zero's infront of the numbers. I was kind of hoping for something that would look a little cleaner.
Is there a way of specifying a " " (space) character as the FillCharacter?0 -
I did a little test & it works
desc := PADSTR(Description, 30 ,' ');
desc2 := PADSTR("Description 2", 30 ,' ');
desc3 := desc+' '+desc2;
Then I printed out desc3 on a report and it was 61 characters
30 + 30 + the space = 61
use the:single quote-space-single quote0
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