At 09:15 PM 9/1/2005, Jim Schmitt wrote:
I have been using the LOADFILENAME Plugin (work great, by the way),
and I have a need to separate the name of the file selected (which
is the last part of the string), and the file path first part of
string. I.e. I have a string returned such as:
'C:\OLTP\ACH\ACHITEMS\CONTRACT.DOC'. I need to split the last file
name (CONTRACT.DOC) in a var, and also to separate the path:
(C\OLTP\ACH\ACHITMES) into another var. I know I could go char by
char from right to left and split the two apart. I wondered if
someone had a more elegant way to split the items.
Jim,
Here's one way to achieve your goal to retrieve the name of selected
document as well as the name of directory, as in your example above.
Use the LoadFileName.RBL Plugin along with (CVAL('CURRDIR')) function.
Example:
-- Start
CLEAR VAR vFileName, vDirName
SET VAR vFileName TEXT = NULL
SET VAR vDirName TEXT = NULL
CLS
PLUGINS LoadFileName.RBL 'vFileName +
|FULLPATH OFF +
|TITLE Select Document +
|VIEW_MODE LIST +
|FILTER MS Word Document Files (*.doc)#*.DOC'
SET VAR vDirName TEXT = (CVAL('CURRDIR'))
RETURN
-- End
Both variables (vFileName and vDirName) will return the document
name and directory name accordingly.
Hope that helps!
Very Best R:egards,
Razzak.