cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • See how to interactively organize and restructure data for analysis. Register for May 29 webinar, 2pm US ET.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
D_G
D_G
Level II

JMP-Classes with instances and global (shared) functions

Hello everyone,

 

I have a question regarding JMP-Classes. I'm using custom classes to create instances as an interface for custom (sql) requests. These classes contain among other things a namespace, a window and a button. It works pretty good - however I have some generall/global classes which i also want to execute within these instances.

 

Dummy sample for a global class:

 

New Namespace("BASICS",
	{		
	
		BASIC_FUNCTION = Function({A, B}, 
		
			C = A * B;	
			Print(C);			
			Return(C);
			
		);
		
	}
);

 

 

And this is my handle function for the submit button. THIS_WN is the class containing the window and the button.

NS is the namespace within this class.

 

 

HANDLE_SUBMIT = Function({THIS_WN}, 

	THIS_WN:GET_WINDOW << Show Window(0);
	
	THIS_WN:NS:A = 2;
	THIS_WN:NS:B = 3;

	THIS_WN:NS:CMD = JSL Quote( 
		Local Here(
			
			Include(Get Path Variable("ADDIN_HOME(~ my AddIn ~)") || "LIB\BASICS.jsl");	
			
			Namespace("$NS$"):RESULT = BASICS:BASIC_FUNCTION(Namespace("$NS$"):A, Namespace("$NS$"):B);
			
			Print(Namespace("$NS$"):RESULT);
			Namespace("$NS$"):RESULT = Namespace("$NS$"):RESULT + 1;
			Print(Namespace("$NS$"):RESULT);
			
			Window("$WN$") << Show Window(1);
			
		);
	);
	
	THIS_WN:NS:CMD = Substitute(THIS_WN:NS:CMD, "$NS$", THIS_WN:NS << Get Name); 
	THIS_WN:NS:CMD = Substitute(THIS_WN:NS:CMD, "$WN$", THIS_WN:GET_WINDOW << Get Window Title); 
	
	Eval(Parse(THIS_WN:NS:CMD));

	Print("HERE");
		
	//CASES	
	//X = 1;
	//Print(THIS_WN:NS:CMD);	
	
);

I can execute the command and get the sql/datatable result. I also have controll over the window within the local here section. However after evaluation the command I really can't do anything else. Starting from "//CASES" all examples are not working, saying that there is no defined variable within this class.

Is there a way to "come back to the class" after a "local here" section?

Thank you in advance !

 

 

1 REPLY 1

Re: JMP-Classes with instances and global (shared) functions

@D_G sorry that there hasn't been a response to your question. Custom classes are relatively new and few folks are familiar with their use. I haven't worked with classes (inside JSL), but it has been on my list of JSL topics to learn more about. I will take a look at what your trying to do and see if I can get you more information.

Recommended Articles