- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
get current dir path from other file (not the jsl file)
Hi guys:)
Small but important question,
I wish to extract the directory path of a table that's used in my script...
To be clear : when I use the function "get default directory()" inside the code - it returns the path from were the script file is and not were the data table I use inside the script - (at the beginning the script working on a table that's "currently open" and in the view of current data table).
So, the question is:
How do i get the path of the data table and no the path of the script file
Thanks, Ariel
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: get current dir path from other file (not the jsl file)
dt = Current Data Table();
dt << getpath;
"C:\Users\...\Desktop\results 2.jmp"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: get current dir path from other file (not the jsl file)
dt = Current Data Table();
dt << getpath;
"C:\Users\...\Desktop\results 2.jmp"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: get current dir path from other file (not the jsl file)
Thanks!!, it worked
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: get current dir path from other file (not the jsl file)
Welcome. I found the data table message like this:
dt = open("$SAMPLE_DATA/big class.jmp");
showProperties( dt );
Begin Data Update [Action] [Scripting Only]
Clear Column Selection [Action] [Scripting Only]
Recode [Action] [Scripting Only]
...
Copy Multi Columns Properties [Action] [Scripting Only]
Paste Multi Columns Properties [Action] [Scripting Only]
Get Labeled Rows [Action] [Scripting Only]
Get Name [Action] [Scripting Only]
Get Path [Action] [Scripting Only]
Get Property [Action] [Scripting Only]
Get Row States [Action] [Scripting Only]
Get Rows Where [Action] [Scripting Only]
...
The data table is a scriptable object in JMP. The Show Properties function works with any scriptable object. The list is the set of messages the data table responds to. There is more information, and a similar list, in the Help->Scripting Index.
If you know a keyword, like "path", you can narrow the search:
The scripting index can search just Objects, just Functions, just Display boxes, or all three. In this case, picking Objects, then Data Table, makes it easier because there are a number of Functions and Display boxes that know something about a path as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: get current dir path from other file (not the jsl file)
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: get current dir path from other file (not the jsl file)
I have similar question. the function "get default directory()" inside the code is to return scrip file's direction path. how can I get the data table direction path that's "currently open". your previous reply about "getpath" is to show direction path + file name but my intention is to get direction path without file name, same output template as "get default directory". how can do it? looking forward to your reply. thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: get current dir path from other file (not the jsl file)
After you get the full path there are many different ways how you can drop the filename. Below is one option
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
cur_path = dt << Get Path;
path_as_list = Words(cur_path, "\/");
path_without_filename = Concat Items(Remove(path_as_list, -1), "/");
Show(cur_path);
//cur_path = "C:\Program Files\SAS\JMPPRO\16\Samples\Data\Big Class.jmp";
Show(path_without_filename);
//path_without_filename = "C:/Program Files/SAS/JMPPRO/16/Samples/Data";
There might be a function which lets you do this easier. If there is one you should be able to find it from File section of Scripting Index
Or from here JSL Syntax Reference > JSL Functions, Operators, and Messages > File Functions , convert file path would be my starting point
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content