Subscribe Bookmark RSS Feed

Running a JSL script within another JSL script

jim_pappas

Community Trekker

Joined:

Oct 1, 2016

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

Joined:

Jun 23, 2011

Solution

Try the Include() function.

 

 

-Jeff
4 REPLIES
Jeff_Perkinson

Community Manager

Joined:

Jun 23, 2011

Solution

Try the Include() function.

 

 

-Jeff
jim_pappas

Community Trekker

Joined:

Oct 1, 2016

Perfect - that works....thanks!
txnelson

Super User

Joined:

Jun 22, 2012

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

Joined:

Jun 23, 2011

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);