BookmarkSubscribe
Choose Language Hide Translation Bar
jim_pappas
Community Trekker

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

0 Kudos
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Jeff_Perkinson
Community Manager Community Manager

Re: Running a JSL script within another JSL script

Try the Include() function.

 

 

-Jeff
5 REPLIES 5
Highlighted
Jeff_Perkinson
Community Manager Community Manager

Re: Running a JSL script within another JSL script

Try the Include() function.

 

 

-Jeff
jim_pappas
Community Trekker

Re: Running a JSL script within another JSL script

Perfect - that works....thanks!
0 Kudos
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
0 Kudos
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 

0 Kudos