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

Running a JSL script within another JSL script

Hello

I hope this one is easy, but I'm having difficulties figuring it out (new JSL user)...

 

I have a "large" JSL script, of which within it, I want to run a "short" JSL script.   However, I do not want to put the code of the shorter script within the larger one since the same code is used within several of my scripts (its a database query builder).

 

Is there a way to simply run the shorter script (it's on my drive:  Q:\Tissue Effect Research\JMP\JMP Apps and Scripts - Read Only\Data Puller) from the larger one?

 

Thanks, Jim

1 ACCEPTED SOLUTION

Accepted Solutions
Jeff_Perkinson
Community Manager Community Manager

Re: Running a JSL script within another JSL script

Try the Include() function.

 

 

-Jeff

View solution in original post

11 REPLIES 11
Jeff_Perkinson
Community Manager Community Manager

Re: Running a JSL script within another JSL script

Try the Include() function.

 

 

-Jeff
jim_pappas
Level II

Re: Running a JSL script within another JSL script

Perfect - that works....thanks!
txnelson
Super User

Re: Running a JSL script within another JSL script

Jim,
I Strongly suggest that you read the Scripting Guide.
Help==>Books==>Scripting Guide
It will give you the base of the structure of JSL, and give you a real leg up on knowing what is available within JSL. It will let you move much faster, rather than having to wait for someone in the Discussion Community to respond.
Jim
pmroz
Super User

Re: Running a JSL script within another JSL script

Include() is great for running code within another JSL script.  You should also look into defining your own functions, because then you can call them within your larger script with parameters.  User-defined functions are documented in Help > Books > Scripting Guide, on page 258 (version 12.2).

 

Here's a simple example function:

add3 = Function({a, b, c}, 
// Add up the three arguments
	tmp = a + b + c;

// The last statement will return the value of tmp to the caller
	tmp;
);

Here are some sample calls to this newly defined function:

x = add3(1, 5, 9);

z = add3(3.14159, 2.7183, 6.721);

 

 

Re: Running a JSL script within another JSL script

Hi Jeff,

 

I met the same question and tried include() function. Could you teach me how to setup name for the data table from the script that I include? 

Below is the script I use now. It didn't work. I need a table name for future scripting.

 

dt_template = Current Data Table();

dt_template = include("A");

 

Thanks a lot 

nath_baillet
Level II

Re: Running a JSL script within another JSL script

Merci

Vraiment, pour la question (qu'on doit être nombreux à se poser) et la réponse (qui peut parait simple aux experts mais qui pour les novices n'est pas évident à trouver dans le "scripting index")

txnelson
Super User

Re: Running a JSL script within another JSL script

I understand your comment about the Scripting Index for the novice user. For novice users, I do think the Scripting index is very helpful for looking at someone's JSL and when something is not understood, taking the function, etc. and then going to the Scripting Index, because one knows exactly what they are looking for.
On the other hand, what I do find extremely helpful for the Novice user, is the Scripting Guide. It allows the new user to learn all about the structure of JSL.
Jim
LogitTurtle576
Level III

Re: Running a JSL script within another JSL script

Hi, I tried to use the "include" function. But I can't manage to make it work.

I have a table with a script called "Cleanup" and one "Run D6708 analysis" (see attachment).

How can I call the script "Cleanup" within the script "Run D6708" ?

 

Thanks

 

Script.jpg

jthi
Super User

Re: Running a JSL script within another JSL script

Include is used when you want to run script from file (or include some functionality of it). To run table script you can use << Run Script

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt << Run Script("Distribution");
-Jarmo