cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
hogi
Level XII

On Save ?

Is there a setting on save() - similar to on close ().

 

Background: Optimize Sharepoint Integration 

A Jmp file doesn't get  uploaded to sharepoint as long as it is opened in Jmp. 

-> If a user clicks on save Jmp should ask the user if it's OK to close the file - to trigger the upload.

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: On Save ?

I'm not sure << Subscribe could work in this case (it does offer On Save)

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt << Subscribe(
	"name1"("client"),
	On Close(Print("Closing Data Table"))
);
f = Function({dtab, oldname},
	Print("oldname", oldname);
	Print("new name", dtab << getname());
);
fsave = Function({dtab, newpathname},
	Print("new path name", newpathname);
	Print("new name", dtab << getname());
);
dt << Subscribe("name1", On Rename(f));
dt << Subscribe("name1", On Save(fsave));
fcols = Function({dtab, b},
	n = N Items(b);
	dtname = (dtab << getname());
	Print(dtname);
	Print(n);
	For(i = 1, i <= n, i++,
		colname = (b[i] << getname());
		Print(colname);
	);
);
dt << Subscribe("name2", On Delete Columns(fcols)); 
//Try deleting a column, then close the data table.
-Jarmo

View solution in original post

5 REPLIES 5
jthi
Super User

Re: On Save ?

I'm not sure << Subscribe could work in this case (it does offer On Save)

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt << Subscribe(
	"name1"("client"),
	On Close(Print("Closing Data Table"))
);
f = Function({dtab, oldname},
	Print("oldname", oldname);
	Print("new name", dtab << getname());
);
fsave = Function({dtab, newpathname},
	Print("new path name", newpathname);
	Print("new name", dtab << getname());
);
dt << Subscribe("name1", On Rename(f));
dt << Subscribe("name1", On Save(fsave));
fcols = Function({dtab, b},
	n = N Items(b);
	dtname = (dtab << getname());
	Print(dtname);
	Print(n);
	For(i = 1, i <= n, i++,
		colname = (b[i] << getname());
		Print(colname);
	);
);
dt << Subscribe("name2", On Delete Columns(fcols)); 
//Try deleting a column, then close the data table.
-Jarmo
hogi
Level XII

Re: On Save ?

wow, amazing - how do you find these things?

jthi
Super User

Re: On Save ?

Usually with I find them using Scripting Index. I either have some idea about which features there are in JMP (I know quite a few of them) which could work or I use some creative searching in scripting index and attempt to narrow down the possible options.

-Jarmo
hogi
Level XII

Re: On Save ?

and me:

1)

hogi_4-1709153859237.png

 

2)

hogi_1-1709153535593.png

 

3) 

hogi_2-1709153615269.png

 

4) https://www.google.com/search?q=on+save++site%3Acommunity.jmp.com 

-> Jarmo will know ...

On Save is even listed in the summary and an example is available - but with my skills I can't find it in Scripting Index.

hogi_3-1709153703893.png

 

jthi
Super User

Re: On Save ?

For me it was something like:

Search for On Save (nothing useful or rather too many items, Subscribe is there if you scroll down to Prototype matches but I didn't and most likely I wouldn't have even tried it)

jthi_0-1709155419658.png

Try On Close to see which could be correct category (too many categories to really filter that down quickly)

jthi_1-1709155446874.png

Notice Subscribe to Data Table List (I'm familiar with that one so I went with that, Subscribe was visible here). Click on that and it selects Row from left (no idea why it is Row and not Data Table)

jthi_2-1709155505264.png

Remove search term to get only Row related items and check if that would have something useful (found nothing useful).

jthi_4-1709155915625.png

Update my search term to Subscribe to find more things related to that and notice that there is Subscribe message (for Data Table) and it happens to support On Save

jthi_3-1709155587158.png

 

There were few steps where I could have noticed Subscribe earlier but I didn't (this time). Most likely easiest way to find it could have been something like "Search for "On Save", select Data Table from left to find only Data Table related items and hope for best"

jthi_5-1709156043282.png

 

-Jarmo