cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
See how to use to use Text Explorer to glean valuable information from text data at April 25 webinar.
Choose Language Hide Translation Bar
View Original Published Thread

Add Script to Existing Script Group

SpannerHead
Level V

As usual, not sure how I got here but I have a script that groups the embedded scripts in a JMP table if they contain the word "History" in the title.  I have a script "Split Table" that I embed later that I would like to add to the "History" group of scripts.  Is there an easy way to do that without disassembling the group in the first place?

 

lstScripts = Current Data Table() << Get Table Script Names;

History_scripts = {};
For( j = 1, j <= N Items( lstScripts ), j++,
	If( Contains ( lstScripts[j] , "History" ),
		Insert Into( History_scripts, lstScripts[j] )
	)
);

Show(History_scripts);

Current Data Table() << Group Scripts( History_scripts ) << rename script group( "Tool History etc.", "History");

 


Slán



SpannerHead
1 ACCEPTED SOLUTION

Accepted Solutions
SpannerHead
Level V

Re: Add Script to Existing Script Group

Thanks Hogi.  Somehow I'm not getting that to work (amateur hour probably).  I'm using this and it works.

 

lstScripts = Current Data Table() << Get Table Script Names;

History_scripts = {};
For( j = 1, j <= N Items( lstScripts ), j++,
	If( Contains ( lstScripts[j] , "History" ),
		Insert Into( History_scripts, lstScripts[j] )
	)
);

For( j = 1, j <= N Items( lstScripts ), j++,
	If( Contains( lstScripts[j], "Split Table" ),
		Insert Into( History_scripts, lstScripts[j] )
	)
);

Current Data Table() << Group Scripts( History_scripts );

Slán



SpannerHead

View solution in original post

5 REPLIES 5
txnelson
Super User


Re: Add Script to Existing Script Group

It looks like you will need to get the names of the scripts in the history group using 

     Get Script Group

Then ungroup the scripts using

     Ungroup Scripts

Then add your the script name that you want to add to the history group

If the history group name list is hisgp

     insert into(hisgp, <the new script name to be added>(

Then create the history group using the updated list using

     Group Scripts

Jim
hogi
Level XII


Re: Add Script to Existing Script Group

Hm , I did not find such a function.

But it's easy to generate it:

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << group scripts(
	"myGroup",
	{"Graph Builder Smoother Line", "Graph Builder Line and Bar Charts",
	"Graph Builder Line Chart", "Graph Builder Heat Map"}
);


insert Script = Function( {dt, groupName, scriptName}, 
//{default local},
	myList = dt << get script group( groupName );
	Insert Into( myList, scriptName );
	dt << group scripts( groupName, mylist );
);

insert Script( dt, "myGroup", "Logistic" ) 

 

hogi
Level XII


Re: Add Script to Existing Script Group

Now I found it:

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << group scripts(
	"myGroup",
	{"Graph Builder Smoother Line", "Graph Builder Line and Bar Charts",
	"Graph Builder Line Chart", "Graph Builder Heat Map"}
);

dt << group scripts("myGroup", "Logistic")
hogi
Level XII


Re: Add Script to Existing Script Group

"I"
... actually it was him:

hogi_0-1737069251285.png


And now I remember ...
I accidentally detected this trick and used it in
 https://marketplace.jmp.com/appdetails/Graph+Builder+Toolbar  / SendToPowerpoint to add scripts of exported graphs to  hogi_1-1737069466419.png

SpannerHead
Level V

Re: Add Script to Existing Script Group

Thanks Hogi.  Somehow I'm not getting that to work (amateur hour probably).  I'm using this and it works.

 

lstScripts = Current Data Table() << Get Table Script Names;

History_scripts = {};
For( j = 1, j <= N Items( lstScripts ), j++,
	If( Contains ( lstScripts[j] , "History" ),
		Insert Into( History_scripts, lstScripts[j] )
	)
);

For( j = 1, j <= N Items( lstScripts ), j++,
	If( Contains( lstScripts[j], "Split Table" ),
		Insert Into( History_scripts, lstScripts[j] )
	)
);

Current Data Table() << Group Scripts( History_scripts );

Slán



SpannerHead