<?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: Adding conditon to variables in graph builder in JSL in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Adding-conditon-to-variables-in-graph-builder-in-JSL/m-p/721959#M90381</link>
    <description>&lt;P&gt;Easiest option is to most likely remove the variable after graph build creation&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");

gb = dt &amp;lt;&amp;lt; Graph Builder(
	Size(528, 492),
	Show Control Panel(0),
	Variables(X(:weight), Y(:height), Group X(:sex)),
	Elements(Points(X, Y, Legend(5)))
);

// gb &amp;lt;&amp;lt; Get Variables; // depending on your graph calculating which index to remova can be a good idea
gb &amp;lt;&amp;lt; Remove Variable(3);
wait(0);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could also build the Variables() part of Graph Builder() message using expressions&lt;/P&gt;</description>
    <pubDate>Mon, 05 Feb 2024 05:32:28 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2024-02-05T05:32:28Z</dc:date>
    <item>
      <title>Adding conditon to variables in graph builder in JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Adding-conditon-to-variables-in-graph-builder-in-JSL/m-p/721925#M90378</link>
      <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to modify the graph builder code which has certain variables. I would like to add conditional statements to include or exclude those certain variables. I tried using if statements, but it doesn't seem to work properly. I would appreciate any suggestions in the matter.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example code:&lt;/P&gt;
&lt;P&gt;I want to take an input from the user (already done with this part), to evaluate whether the user wants the results against the test temp (for example). I do have other variables to plot against, but I provided test temp to simplify the example.&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// x will be taken as an input  
 
Graph Builder(
	Size( 1257, 829 ),
	Level Spacing Color( "Black" ),
	Variables( Y( :TX_EVM ), Y( :TX_EVM ), If( Equal( X, 1 ), Group X( :Test_Temp ) ) ),
	Elements( Box Plot( Y, Legend( 19 ) ) ),
	Local Data Filter(
		Add Filter(
			columns( :Test_Temp ),
			Where( :Test_Temp == {"test temp1 ", "test temp2", "test temp3"} )
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/DIV&gt;</description>
      <pubDate>Mon, 05 Feb 2024 03:37:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Adding-conditon-to-variables-in-graph-builder-in-JSL/m-p/721925#M90378</guid>
      <dc:creator>RA899</dc:creator>
      <dc:date>2024-02-05T03:37:57Z</dc:date>
    </item>
    <item>
      <title>Re: Adding conditon to variables in graph builder in JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Adding-conditon-to-variables-in-graph-builder-in-JSL/m-p/721959#M90381</link>
      <description>&lt;P&gt;Easiest option is to most likely remove the variable after graph build creation&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");

gb = dt &amp;lt;&amp;lt; Graph Builder(
	Size(528, 492),
	Show Control Panel(0),
	Variables(X(:weight), Y(:height), Group X(:sex)),
	Elements(Points(X, Y, Legend(5)))
);

// gb &amp;lt;&amp;lt; Get Variables; // depending on your graph calculating which index to remova can be a good idea
gb &amp;lt;&amp;lt; Remove Variable(3);
wait(0);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could also build the Variables() part of Graph Builder() message using expressions&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2024 05:32:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Adding-conditon-to-variables-in-graph-builder-in-JSL/m-p/721959#M90381</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-02-05T05:32:28Z</dc:date>
    </item>
    <item>
      <title>Re: Adding conditon to variables in graph builder in JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Adding-conditon-to-variables-in-graph-builder-in-JSL/m-p/722153#M90410</link>
      <description>&lt;P&gt;Thank you Jarmo for your help. Your code works perfectly fine, but when implement the same technique to my original code it isn't working. My code actually does create multiple graph builders and appends them. I tried to remove variables after each graph builder, but it doesn't seem to make any difference.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A simplified version of the code I have is this:&amp;nbsp;&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;gb = {}; // initiate list 

&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;	// loop through the test list 
	index = N Items( gb );//
	gb[index + 1]= New Window( "Capability", hlb = H List Box() );
	hlb &amp;lt;&amp;lt; append(//
	Graph Builder(
    Size( 1800, 700),//
    Variables(
		X( :Temp, Position( 1 ) ),
		X( :Location, Position( 1 ) ),
		
		Y( TestList[i3] ), // this is 
		
		

    ),
    Elements( Histogram( X( 1 ), X( 2 ), X( 3 ), Y, Legend( 46 ), Means and Std Devs( 1 )),Smoother( X( 1 ), X( 2 ), X( 3 ), X( 4 ), Y, Legend( 49 ) )  ,Caption Box(
			X( 1 ),
			X( 2 ),
			X( 3 ),
			Y,
			Legend( 51 ),
			Summary Statistic( "Mean" ),
			
		) ),
    Local Data Filter(
     .
     .
     .
     .
     .
     .
     .
     
    ),
    SendToReport(
      .
      .
      .
      .
      .
      .
      .
				)
						);		

      );
      
      //end loop&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2024 18:03:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Adding-conditon-to-variables-in-graph-builder-in-JSL/m-p/722153#M90410</guid>
      <dc:creator>RA899</dc:creator>
      <dc:date>2024-02-05T18:03:29Z</dc:date>
    </item>
    <item>
      <title>Re: Adding conditon to variables in graph builder in JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Adding-conditon-to-variables-in-graph-builder-in-JSL/m-p/722165#M90413</link>
      <description>&lt;P&gt;You might have to wrap your&amp;nbsp;TestList[i3] with something. Below are some options&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1); 

dt = open("$SAMPLE_DATA/Big Class.jmp");

mycol = "weight";

gb = dt &amp;lt;&amp;lt; Graph Builder(
	Size(528, 448),
	Show Control Panel(0),
	Variables(X(:age), X(:sex), Y(mycol)), // won't work
	Elements(Position(1, 1), Points(X, Y, Legend(6))),
	Elements(Position(2, 1), Points(X, Y, Legend(7)))
);


gb = dt &amp;lt;&amp;lt; Graph Builder(
	Size(528, 448),
	Show Control Panel(0),
	Variables(X(:age), X(:sex), Y(Eval(mycol))), // might work
	Elements(Position(1, 1), Points(X, Y, Legend(6))),
	Elements(Position(2, 1), Points(X, Y, Legend(7)))
);


Eval(EvalExpr(
	gb = dt &amp;lt;&amp;lt; Graph Builder(
		Size(528, 448),
		Show Control Panel(0),
		Variables(X(:age), X(:sex), Y(Expr(NameExpr(AsColumn(mycol))))), // works
		Elements(Position(1, 1), Points(X, Y, Legend(6))),
		Elements(Position(2, 1), Points(X, Y, Legend(7)))
	)
));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2024 19:21:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Adding-conditon-to-variables-in-graph-builder-in-JSL/m-p/722165#M90413</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-02-05T19:21:14Z</dc:date>
    </item>
  </channel>
</rss>

