how to avoid hardwiring file and path names

I noticed the name and path of the template file was hardwired. It also didn’t have an extension (.dot being the right extension, I believe.) This is OK if the templates are on the C:\ drive with the desired directories on it---- but what happens if some user has the Windows data files on the D:\ drive? (I recently did a project where the company had some PCs which had W98, XP and W2000 on them— W98 users would find these files on C:, W2000 users would find these files on D:, and XP users on E:) What is the best way to deal with the situation where not every workstation has the same drive letters and directory names on it? ------- Tim Horrigan

Try using ENVIRON(). Maybe ENVIRON(WinDir) would solve the problem. Open a DOS-box and type SET. Then You see all the variables You can call with ENVIRON(). Just be avare that the avaliable environment variables can differ between 95/98/2000 and XP. But I think that windir works in all environments. //Lars

Another option is to use the OSVERSION command : OSVERSION Use this function to return a string which contains the name and version of the operating system or operating environment. String := OSVERSION String Data type: text constant or code This string tells you the type and version of the operating system or operating environment. Here are some typical examples of what the system returns: If the operating system/environment is… The system returns… Windows 3.1 Windows_3.1 Windows 3.11 Windows_3.11 Windows 95 Windows_95_4.02 Windows NT Windows_NT_3.5 Example This example shows how to use the OSVERSION function. Ver := OSVERSION; MESSAGE(Text000, Ver); Create the following text constant in the C/AL Globals window: Text Constant ENU Value Text000 ‘The operating system is: %1’ A typical result: The operating system is: WIN_95_4.02 ###### Tarek Demiati Freelance Navision Developer Email : Phone : + 65 - 906 787 16

Based on a small test and the following information in the V2.6 Help, I would not characterize this path as “hard wired” but simply as having a standard default that could be changed when the client is installed. HELP contents: TempFilePath When Navision Financials is running, it creates a number of temporary files that are automatically deleted when the program is closed. As a default, these files are put in the Temp folder unless you have specified a different working folder. If you have, the working folder will be the default location. You must specify the full path, including the drive and all folders. If you are running on Windows 2000, the temporary files of each individual user are stored in C:\Documents and Settings\User Name\Application Data\Local Settings\Temp, unless you specify a different working folder. If you are not running on Windows 2000, the temporary files are stored in the same folder as the Navision Financials program files, unless you specify a different working folder. Dave Studebaker Liberty Grove Software A Navision Services Partner

I don’t know if this holds for W2K or WXP, but Windows 98 and earlier Windows have a handy environment variable called “TEMP” which points to the Windows temporary directory. Typically the directory is “C:\WINDOWS\TEMP”. (The filepath is not case-sensitive, but the environment variable name is case-sensitive.) There is also a second standard environment variable called “TMP” which also typically points to “C:\WINDOWS\TEMP”. Windoze needs to have at least one directory which the user can write to, and this is a handy directory to use if you want to create files in Navision. I have found it is a good idea to create files in the TEMP directory first and then subsequently move them to their final destination, just in case the final destination directory doesn’t exist, is not write-enabled, etc. ------- Tim Horrigan