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.

Advertisements
Tagged with: ,
Posted in NAV

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: