USER defined functions: Check if the function exists/loaded after IncludeHi Folks,
I am trying to figure out a way to check if a user defined function exists before calling it. Is there a way to do this check in JMP?
Eg:
user_func.jsl:
user_func = Function ({},{},
.....
);
Main.jsl:
Include("C:\Documents\user_func.jsl")
.
down in the code
.
.
??How to check if user_func exists??
Re: USER defined functions: Check if the function exists/loaded after IncludeNames Default to Here( 1 );
user_func = Function( {}, Print( "I'm Here!" ) );
func_name = "user_func";
Show( Is Empty( Parse( func_name || "()" ) ) ); Re: USER defined functions: Check if the function exists/loaded after IncludeHere is how I would handle that case
func_name = "user_func";eval(parse("Show( Is Empty( " || func_name || ") ) ;"));Re: USER defined functions: Check if the function exists/loaded after IncludeHi Jim @txnelson ,
In another case, what to do if the function name is stored as a string in a variable?
Clear Symbols();<BR />
user_func = Function( {}, {} );
<BR />func_name = "user_func";<BR /><BR />Show( Is Empty( Parse(func_name) ) ); //This doesnt work, any alternatives???
<BR />Clear Symbols();
Re: USER defined functions: Check if the function exists/loaded after IncludeThat worked, thank you very much !Re: USER defined functions: Check if the function exists/loaded after IncludeYou can use the IsEmpty() function. See the example below;
<FONT face="Menlo,Monaco,Consolas,"Courier New",monospace" size="2" style="background-color: #f5f5f5;">Clear Symbols();<BR />Show( Is Empty( user_func ) );<BR />user_func = Function( {}, {} );<BR />Show( Is Empty( user_func ) );</FONT>clear symbols();