Subscribe Bookmark RSS Feed

Referening data file distributed within an add-in

kabir

Community Trekker

Joined:

Jan 29, 2015

For my jsl to work, I refer to a data table. Now for distributing it, I am building an add-in (lets call it test_addin) for it and adding the data file in it under the "Additional Files" tab in the add-in builder. Once installed, the data file gets saved in the same folder as the jmp add-in file.

e.g. both data file and the jsl for the add-in are saved at the address below- C:\Users\MyUserID\AppData\Local\SAS\JMP\Addins\test_addin\

now the "MyUserID" part will be different for each user.... How would I reference it later as I will not know the users who install it?

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

You could use the addin shortcut.  Suppose the "alias" for your addin is com.mycompany.test_addin.  Then you could simply refer to a file using $ADDIN_HOME:

"$ADDIN_HOME(com.mycompany.test_addin)\myfile.jmp";

4 REPLIES
acohen

Community Member

Joined:

Oct 7, 2014

Perhaps the Journal Packager add-in will do the trick for you. I've used it successfully for what seems like the same purpose as yours.

From the add-in description: "Sharing large journals, containing file references scattered across a labyrinthine directory structure, can be problematic.This addin allows the user to package a journal for easy sharing"

First I use Journal Packager to package the Journal and the files, then I use the instructions in this blog post on building add-ins for classes and textbooks to create the add-in.

kabir

Community Trekker

Joined:

Jan 29, 2015

Thanks for the help.

Thought of a simple way that it would work for my case at least-just,  saving the file on the C drive so no user id goes into the refencing part. Absolute/ relative reference will remain the same for all users. Jsl command like get user id would be really useful as well but I don't think it exists yet. So along with the add-in, I also request the users to add this additional file on the C drive and my jsl references to it.

Solution

You could use the addin shortcut.  Suppose the "alias" for your addin is com.mycompany.test_addin.  Then you could simply refer to a file using $ADDIN_HOME:

"$ADDIN_HOME(com.mycompany.test_addin)\myfile.jmp";

kabir

Community Trekker

Joined:

Jan 29, 2015

Thanks, this works perfect!