cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar

Working with File Paths

Started ‎11-08-2022 by
Modified ‎11-08-2022 by
View Fullscreen Exit Fullscreen

In order for your script to open your data table, it has to tell JMP where to find the table. So, you need to understand how file paths work. The path to a file starts from the root (or disk drive) and continues with the sequence of folders that leads to the folder where the file is saved. So, the sequence reflects the series of folders that JMP has to navigate, starting at the root, in order to get to the file. JMP prefers the Portable Operating System Interface, or POSIX format, where the folders in the path are separated by forward slashes. This means that for scripts that run on both Windows and macOS, your script doesn't have to identify the current operating system. However, you can convert between Windows and POSIX file path formats if needed using the Convert File Path function. The only required argument in this function is the path, specified as a character string. Optional arguments can specify whether the path is absolute or relative, and whether you want to convert to the POSIX or Windows format. JMP maintains a set of path variables that can be used as shortcuts to commonly used directories. The name of a path variable begins with a dollar sign. Examples of these built-in path variables include HOME, ADDIN_HOME, DESKTOP, DOCUMENTS, DOWNLOADS, and SAMPLE_DATA. To use one of these path variables in the argument for the Open function, you specify a character string made up of the path variable, a forward slash, and then the file name and extension. For example, this code opens the Big Class data table that's stored in the Sample Data directory. The Get Path Variable function takes a path variable name without the dollar sign as its argument, and returns the path as a character string. Also, you can define and maintain your own set of path variables using the Set Path Variable function. You specify both the name of the variable and the path as character strings. But don't start the name of your path variable with the dollar sign -- that's reserved for the built-in path variables. You can determine the current value of your path variables using the same Get Path Variable function that works with the built-in path variables.