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
Kast
Level II

Event Handler: How to implement a relative file path? (JMP 17.0.0 - Windows 10)

I'm trying to create a column in table1 with an Event Handler which has a link to a different table "table2" in the same folder "path1". I.e. Click on the link in table1 it opens table2.

 

I'm using Open(); in the Event Handler
If I use an absolute path (for testing purposes) it works great. - I don't think there are any issues with my filename.

I don't want to use an absolute path, because I'm generating the Event Handler Column of interest via a JSL script and the path will not always be the same. I'm looking for a more universal solution. Table1 & Table2 will always be in the same folder as each other.

I think I need to use a relative path or find a way for the code in the event handler to find the absolute path to table1 itself.

I've tried using Get Default Directory () and Convert File Path ("") but both seem to give the default path "...\Documents\"

It sounds like Get Default Directory and Convert File Path ("") worked for saved scripts. It seems like the script in the Event Handler is not saved and is not finding the path of the table1 that the event handler is in.

Thank you for any help or resources you can provide. - Kast

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Event Handler: How to implement a relative file path? (JMP 17.0.0 - Windows 10)

You might be able to use Current Data Table() << Get Path

Function({thisTable, thisColumn, iRow}, {cur_path, cur_folder},
	cur_path = Current Data Table() << get path;
	cur_folder = Substr(cur_path, 1, Contains(cur_path, "\", -1));
	Open(cur_folder || thisColumn[iRow]);
);
-Jarmo

View solution in original post

2 REPLIES 2
jthi
Super User

Re: Event Handler: How to implement a relative file path? (JMP 17.0.0 - Windows 10)

You might be able to use Current Data Table() << Get Path

Function({thisTable, thisColumn, iRow}, {cur_path, cur_folder},
	cur_path = Current Data Table() << get path;
	cur_folder = Substr(cur_path, 1, Contains(cur_path, "\", -1));
	Open(cur_folder || thisColumn[iRow]);
);
-Jarmo
Kast
Level II

Re: Event Handler: How to implement a relative file path? (JMP 17.0.0 - Windows 10)

Thank you, this worked perfectly.