RSS

Tag Archives: C/AL

Getting a filename in NAV

Here is a function to strip the Filename from it’s path in NAV.
Ex: C:\Temp\Import\MyFilename.xml will become MyFilename.xml

fctGetFilename(ptxtFilename : Text[1024]) ltxtFileName : Text[1024]
ltxtFileName := ptxtFilename;

lintSlashPos := STRPOS(ltxtFileName, ‘\’);

WHILE lintSlashPos > 0 DO BEGIN
   ltxtFileName := COPYSTR(ltxtFileName, lintSlashPos+1);
   lintSlashPos := STRPOS(ltxtFileName, ‘\’)
END;

Usefull for when you need to create a backup from a file after importing it with a dataport.

 
Leave a comment

Posted by on March 6, 2009 in NAV

 

Tags: ,

 
Follow

Get every new post delivered to your Inbox.