<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: JMP-Classes with instances and global (shared) functions in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/JMP-Classes-with-instances-and-global-shared-functions/m-p/479622#M72398</link>
    <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/22109"&gt;@D_G&lt;/a&gt; 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. &lt;/P&gt;</description>
    <pubDate>Fri, 15 Apr 2022 21:29:30 GMT</pubDate>
    <dc:creator>DonMcCormack</dc:creator>
    <dc:date>2022-04-15T21:29:30Z</dc:date>
    <item>
      <title>JMP-Classes with instances and global (shared) functions</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Classes-with-instances-and-global-shared-functions/m-p/475152#M71981</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dummy sample for a global class:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;New Namespace("BASICS",
	{		
	
		BASIC_FUNCTION = Function({A, B}, 
		
			C = A * B;	
			Print(C);			
			Return(C);
			
		);
		
	}
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And this is my handle function for the submit button. &lt;CODE class=" language-jsl"&gt;THIS_WN&lt;/CODE&gt; is the class containing the window and the button.&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-jsl"&gt;NS&lt;/CODE&gt; is the namespace within this class.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;HANDLE_SUBMIT = Function({THIS_WN}, 

	THIS_WN:GET_WINDOW &amp;lt;&amp;lt; 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$") &amp;lt;&amp;lt; Show Window(1);
			
		);
	);
	
	THIS_WN:NS:CMD = Substitute(THIS_WN:NS:CMD, "$NS$", THIS_WN:NS &amp;lt;&amp;lt; Get Name); 
	THIS_WN:NS:CMD = Substitute(THIS_WN:NS:CMD, "$WN$", THIS_WN:GET_WINDOW &amp;lt;&amp;lt; Get Window Title); 
	
	Eval(Parse(THIS_WN:NS:CMD));

	Print("HERE");
		
	//CASES	
	//X = 1;
	//Print(THIS_WN:NS:CMD);	
	
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;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.&lt;BR /&gt;&lt;BR /&gt;Is there a way to "come back to the class" after a "local here" section?&lt;BR /&gt;&lt;BR /&gt;Thank you in advance !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 18:15:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Classes-with-instances-and-global-shared-functions/m-p/475152#M71981</guid>
      <dc:creator>D_G</dc:creator>
      <dc:date>2023-06-09T18:15:01Z</dc:date>
    </item>
    <item>
      <title>Re: JMP-Classes with instances and global (shared) functions</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Classes-with-instances-and-global-shared-functions/m-p/479622#M72398</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/22109"&gt;@D_G&lt;/a&gt; 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. &lt;/P&gt;</description>
      <pubDate>Fri, 15 Apr 2022 21:29:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Classes-with-instances-and-global-shared-functions/m-p/479622#M72398</guid>
      <dc:creator>DonMcCormack</dc:creator>
      <dc:date>2022-04-15T21:29:30Z</dc:date>
    </item>
  </channel>
</rss>

