KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: How to avoid opening a resource from a wrong database structure
PRODUCT: 4D | VERSION: | PLATFORM: Win
Published On: April 10, 2002
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

Compatibility: 6.5.x and 6.7.x

Before opening a database resource, you should always check to see if the database is interpreted or compiled. If the path to the resource file is hardcoded in the command Open resource file, then you do not need to worry about this. Otherwise, the type of the database should be detemined before you begin the rest of the operation. This is important if you want to open the resource file procedurally. You will need to know what the extension of the structure file is so that you can replace it to .RSR.

On Windows, an interpreted database has an extension of .4DB and a compiled database has an extension of .4DC.

Sample Code:

C_LONGINT($vlPlatform;$vlSystem;$vlMachine)
PLATFORM PROPERTIES($vlPlatform;$vlSystem;$vlMachine)
If ($vlPlatform=3)
If (Compiled application)
$vhStructureResFile:=Open resource file(Replace string(Structure file;".4DC";".RSR"))
Else
$vhStructureResFile:=Open resource file(Replace string(Structure file;".4DB";".RSR"))
End if
Else
$vhStructureResFile:=Open resource file(Structure file)
End if