KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Obtaining File Type Information
PRODUCT: 4D | VERSION: 17 | PLATFORM: Mac & Win
Published On: August 16, 2018
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

In v17, the Document type command has become depreciated and in its place has been succeeded by the new command Path to object command.

Both commands behave similarly with the major difference being the results returned. Document type simpily returned the extension or type of document for a pathname passed.
The Path to object command returns an object that contains more information about the path passed including the extention as one of the properties.

For Example:

C_TEXT($resultText)
$resultText:=Document type("C:\\Users\user\\Desktop\\MyText.txt")

$resultText contains



C_OBJECT($resultObject)
$resultObject:=Path to object("C:\\Users\user\\Desktop\\MyText.txt")

$resultObject contains:

To directly obtain the extension in this case the property can be accessed with $resultObject.extension

Note:
Both the commands do not confirm that the path is valid or exists. This can be confirmed with the Test path name command.