A nice bit of lateral thinking! And if you did mind deleting it first you could always make a copy if it was there...
Regards, Alastair. From: Stephen Markson Sent: Monday, January 28, 2013 7:00 PM To: RBASE-L Mailing List Subject: [RBASE-L] - Re: Is a file Open? Unfortunately, for a variety of reasons, the unique file name solution will not work in our environment. However, as you say, nothing is impossible and the following will work for us: Since I am about to create a new report or text file, I don't mind deleting it first. If the file is open, then R> DELETE filename will generate error 2262: -ERROR- Failed deleting filename. Problem solved! Regards, Stephen Markson The Pharmacy Examining Board of Canada 416.979.2431 x251 > -----Original Message----- > From: [email protected] [mailto:[email protected]] On Behalf Of A. > Razzak Memon > Sent: Monday, January 28, 2013 1:15 PM > To: RBASE-L Mailing List > Subject: [RBASE-L] - Re: Is a file Open? > > At 01:03 PM 1/28/2013, Stephen Markson wrote: > > >Thanks Razzak, > > > >Is it possible to detect if a file is open? > > You are welcome, Stephen! > > TTBOMK, currently, there is no function available to detect if an > external > file is open or not. Thus, the reason to provide you with a sample code > to > help you take advantage of R:BASE functions in a multi-user environment. > > Having said that, as you may know, nothing is impossible! > > Very Best R:egards, > > Razzak. > > > > > -----Original Message----- > > > From: [email protected] [mailto:[email protected]] On Behalf Of A. > > > Razzak Memon > > > Sent: Monday, January 28, 2013 12:45 PM > > > To: RBASE-L Mailing List > > > Subject: [RBASE-L] - Re: Is a file Open? > > > > > > At 11:27 AM 1/28/2013, Stephen Markson wrote: > > > > > > >How does one check if a file is open (in use)? > > > > > > > >If you do R> OUTPUT somefile, or R> PRINT reportname OPTION > > > PDF|FILENAME > > > >somefile, and someone has the file open, then nothing is produced. > > > > > > > > > Stephen, > > > > > > In a multi-user environment, you should adapt the technique to > > > dynamically > > > create a unique file name to avoid such instances. > > > > > > You may use the new (CVAL('GUID')) function to create a unique file > > > name. > > > > > > Here are two simple examples that you may modify and adopt, if you > wish. > > > > > > -- Example 01 > > > -- Using R:BASE eXtreme 9.5 (64) > > > IF (CVAL('DATABASE')) <> 'RRBYW18' OR (CVAL('DATABASE')) IS NULL > > > THEN > > > CONNECT RRBYW18 IDENTIFIED BY NONE > > > ENDIF > > > CLEAR VARIABLE vPDFFileName > > > SET VAR vPDFFileName TEXT = > > > ((CVAL('NetUser'))+'_'+(CVAL('GUID'))+'.PDF') > > > PRINT InvoiceSummary + > > > OPTION PDF + > > > |FILENAME .vPDFFileName + > > > |SHOW_CANCEL_DIALOG ON + > > > |TITLE Running R:BASE Your Way! + > > > |SUBJECT Invoice Summary + > > > |AUTHOR R:BASE eXtreme 9.5 + > > > |KEYWORDS Invoice Summary + > > > |OPEN ON > > > CLEAR VARIABLES vPDFFileName > > > RETURN > > > > > > -- Example 02 > > > -- Using R:BASE eXtreme 9.5 (32) > > > IF (CVAL('DATABASE')) <> 'RRBYW18' OR (CVAL('DATABASE')) IS NULL > > > THEN > > > CONNECT RRBYW18 IDENTIFIED BY NONE > > > ENDIF > > > CLEAR VARIABLE vPDFFileName > > > SET VAR vPDFFileName TEXT = + > > > ((CVAL('NetUser'))+'_'+(FORMAT(.#NOW,'MMDDYYYY_HHNN'))+'.PDF') > > > PRINT InvoiceSummary + > > > OPTION PDF + > > > |FILENAME .vPDFFileName + > > > |SHOW_CANCEL_DIALOG ON + > > > |TITLE Running R:BASE Your Way! + > > > |SUBJECT Invoice Summary + > > > |AUTHOR R:BASE eXtreme 9.5 + > > > |KEYWORDS Invoice Summary + > > > |OPEN ON > > > CLEAR VARIABLES vPDFFileName > > > RETURN > > > > > > Hope that helps! > > > > > > Very Best R:egards, > > > > > > Razzak. > > > > > > www.rbase.com > > > www.facebook.com/rbase > > > >

