KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Create document and Test path name GotCha.
PRODUCT: 4D | VERSION: | PLATFORM: Mac & Win
Published On: September 13, 2002

Compatibility: 6.7.x and 6.8.x


Here is the example provided by the Document and can be found at https://ftp.4d.com/aci_Technical_notes/ACIDOC/CMU/CMU00476.HTM

If (Test path name("Journal") # Is a document)
 $vhDocRef:=Create document("Journal")
 If (OK=1)
   CLOSE DOCUMENT($vhDocRef)
 End if
End if


This example will work fine under the Mac OS. However, you must understand that under Windows with this code, Test path name will always return false. The reason is that Create document("Journal") will actually create a file named Journal.txt. When you use Test path name("Journal"), it is looking for a file named Journal and will not recognize Journal.txt.