File path is breaking
kmkaot
Member Posts: 261
I want a create PDF file,
-
- saved file using save as pdf function
- when I want attach the file
- name is breking into line like d:\temp\invoice.pdf like

- temp
- Invoice.pdf
Please help me how to retrive file from path
Warm regards
Krsh
0
Answers
-
To retrieve the filename only you can keep stripping of everything upto the next slash, something like this...
FileName := FilePathAndName; WHILE STRPOS(FileName,'\') > 0 DO FileName := COPYSTR(FileName, STRPOS(FileName,'\') +1);
0 -
Thanks
Actually I want my file name should be for example 'D:\temp\invoice.pdf'
not
like this
d:
Temp
Invoice.pdf
Please help me,
Kris
0 -
That is only splitting when you display it using MESSAGE or ERROR because the backslash character is being interpreted as a new line. In order to work around this you could convert it to a forward slash when displaying it, e.g.
MESSAGE(CONVERTSTR(FileAndPathName,'\','/'));
0 -
SMTPsetup.GET;
SenderName:=SMTPsetup."Email sender Name";
SenderAddress:=SMTPsetup."Email sender email";
Recipients:=vendorRec."E-Mail"+';'+SMTPsetup."Manager Email";
kSubject:="No."+' PO for '+FORMAT(Amount);
kBody:=' ';
Tofile := Name;
Tofile := "No."+'.pdf';
FileName := SMTPsetup."Path to Save Report" + Tofile;
FileName := CONVERTSTR(FileName,'/','\');
MESSAGE(CONVERTSTR(FileName,'/','\'));
CurrPage.SETSELECTIONFILTER(Rec);
REPORT.SAVEASPDF(405, FileName, Rec);
CLEAR(email);
email.CreateMessage(Recipients,'','',kSubject,kBody,FALSE,FALSE);
email.AddBodyline(' Dear Sir/Madam');
email.AddBodyline('<BR><BR>');
email.AddBodyline(' PO Document '+"No."+' '+"Pay-to Name"+' approved ');
email.AddBodyline('<BR><BR>');
email.AddBodyline('Operations');
email.AddBodyline('<BR><BR>');
email.AddBodyline('Shura');
email.AttachFile(FileName);
email.Send();0 -
You have the slash and backslash the wrong way round in your message - see my previous post0
-
file path works only with back slash '\' not '/'.
i am i right?0 -
I think it might work with either (even though traditionally it's been \ from the good old DOS days
). Give it a try.
For displaying in a message though, it doesn't really matter I would have thought.0 -
file path works only with back slash '\' not '/'.
i am i right?
No! Windows handles forward slashes just all right as path separators in file paths. Many programs do not, though. On the command line, you need to quote a path containing forward slashes, because the forward slash is the traditional option start character on DOS/Windows command lines.
Back to NAV: For a MESSAGE command to display a file path properly, use value substitution:MESSAGE('%1',FileName);Backslashes in the String parameter get converted to Newlines, backslashes in the Valuen parameters are preserved. (See link above.)
With appending the file to the eMail message, I did not have any issue. No conversion needs to be done. It won't hurt, though, because of what I said in the beginning.0
Categories
- All Categories
- 73 General
- 73 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
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 328 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
