- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
USER defined functions: Check if the function exists/loaded after Include
Hi 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??
2 ACCEPTED SOLUTIONS
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: USER defined functions: Check if the function exists/loaded after Include
You can use the IsEmpty() function. See the example below;
Clear Symbols();Show( Is Empty( user_func ) );user_func = Function( {}, {} );Show( Is Empty( user_func ) );clear symbols();
Jim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: USER defined functions: Check if the function exists/loaded after Include
Here is how I would handle that case
func_name = "user_func";eval(parse("Show( Is Empty( " || func_name || ") ) ;"));
Jim
5 REPLIES 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: USER defined functions: Check if the function exists/loaded after Include
You can use the IsEmpty() function. See the example below;
Clear Symbols();Show( Is Empty( user_func ) );user_func = Function( {}, {} );Show( Is Empty( user_func ) );clear symbols();
Jim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: USER defined functions: Check if the function exists/loaded after Include
That worked, thank you very much !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: USER defined functions: Check if the function exists/loaded after Include
Created:
Jul 24, 2019 03:07 PM
| Last Modified: Jul 24, 2019 12:08 PM
(4702 views)
| Posted in reply to message from txnelson 07-22-2019
Hi Jim @txnelson ,
In another case, what to do if the function name is stored as a string in a variable?
Clear Symbols();
user_func = Function( {}, {} );
func_name = "user_func";Show( Is Empty( Parse(func_name) ) ); //This doesnt work, any alternatives???
Clear Symbols();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: USER defined functions: Check if the function exists/loaded after Include
Here is how I would handle that case
func_name = "user_func";eval(parse("Show( Is Empty( " || func_name || ") ) ;"));
Jim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: USER defined functions: Check if the function exists/loaded after Include
Names Default to Here( 1 );
user_func = Function( {}, Print( "I'm Here!" ) );
func_name = "user_func";
Show( Is Empty( Parse( func_name || "()" ) ) );