Karen,

 

Thanks. I have folders that have spaces at times and forgot about using
the quotes to care for that.

Sometimes it is the simple things that bite me. 

I already use a WHILE LOOP for some of my code in searching for specific
PDF files.

I should be able to adapt this.

 

James Belisle

________________________________

From: [email protected] [mailto:[email protected]] On Behalf Of
[email protected]
Sent: Wednesday, February 09, 2011 10:34 AM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: Getting a file from a directory

 

Jim:  Following is the code I used.  The client says that stopping at
30 is a good number.  Let me know if it doesn't wrap right and I can
privately email you a text file.   In this case, the part#s can have
spaces in the name, and that made it a little more difficult.
  

SET VAR vFilenamePart = ( CVAL("QUOTES") + "F:\Data\Shop\Exceptions\" +
.v_custpart + "r")

SET VAR vLoop INT = 1
WHILE vLoop <= 30 THEN
  SET VAR vFilename = (.vFilenamePart +  + CTXT(.vLoop) + ".doc" +
CVAL("QUOTES") )

  -- For some reason, just putting the "set var vcount =" command by
itself
  -- always yielded 0.  I think it's because of the quotes in the
filename, which
  -- is needed because the part# could have spaces in it.
  SET VAR vCommand = ("SET VAR vCount = (CHKFILE(" + .vFilename + "))" )
  &vCommand

  IF vCount > 0 THEN
    BREAK
  ENDIF

  SET VAR vLoop = (.vLoop + 1)
ENDWHILE

IF vCount = 0 THEN
  PAUSE 2 USING "No Exceptions file for this part" CAPTION "No file"
OPTION MESSAGE_FONT_SIZE 11
ELSE
  LAUNCH .vFilename
ENDIF

RETURN






If you get this to work perfectly, I would be interested in the code
that gives you what you want.

We have one area where the spec sheets are related to more than one item
and this may be the answer I am looking for.

  

James Belisle



 

Reply via email to