<?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 Reference a scale box with a variable in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Reference-a-scale-box-with-a-variable/m-p/15598#M14279</link>
    <description>&lt;P&gt;&lt;BR /&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to produce multiple graphs with a for loop, and assign the column title to the Y axis.&lt;/P&gt;
&lt;P&gt;After graphing, I want to add three reference lines to the Y axis with a Dispatch command, but cannot figure out how to dynamically reference the Y axis box, see *** below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For( i = 12, i &amp;lt;= 18, i++,
	Col_name = Column( i ) &amp;lt;&amp;lt; Get Name;
	temp = Expr( Col_name );
//Graph Line Data
	Split_dt &amp;lt;&amp;lt; Graph Builder(
		Size( 536, 500 ),
		Variables( X( :Year ), X( :Month, Position( 1 ) ), X( :Day, Position( 1 ) ), Y( Column( i ) ) ),
		Elements(
			Box Plot( X( 1 ), X( 2 ), Y, Legend( 9 ), Jitter( 1 ), Outliers( 1 ), Box Style( "Outlier" ) )
		),
		SendToReport(
			Dispatch(
				{},
				,
				ScaleBox,
				{Add Ref Line( 9, Solid, "Black", "LSL" ), Add Ref Line( 21, Solid, "Black", "USL" ),
				Add Ref Line( 16, Dashed, "Medium Dark Green", "Target" )}
			)
		),
		SendToReport(
			Dispatch(
				{},
				"graph title",
				TextEditBox,
				{Set Text( "Line " || Char( Line_Number ) || " " || Col_name )}
			)
		)
	);
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This code returns the error "Cannot find ScaleBox[ "Col_name" ] at {}", as if JSL is evaluating Col_name as a string.&lt;/P&gt;
&lt;P&gt;Any ideas on for to make Col_name evaluate to it's value, or add the ref lines differently?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 25 Jun 2018 15:36:41 GMT</pubDate>
    <dc:creator>bensyork</dc:creator>
    <dc:date>2018-06-25T15:36:41Z</dc:date>
    <item>
      <title>Reference a scale box with a variable</title>
      <link>https://community.jmp.com/t5/Discussions/Reference-a-scale-box-with-a-variable/m-p/15598#M14279</link>
      <description>&lt;P&gt;&lt;BR /&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to produce multiple graphs with a for loop, and assign the column title to the Y axis.&lt;/P&gt;
&lt;P&gt;After graphing, I want to add three reference lines to the Y axis with a Dispatch command, but cannot figure out how to dynamically reference the Y axis box, see *** below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For( i = 12, i &amp;lt;= 18, i++,
	Col_name = Column( i ) &amp;lt;&amp;lt; Get Name;
	temp = Expr( Col_name );
//Graph Line Data
	Split_dt &amp;lt;&amp;lt; Graph Builder(
		Size( 536, 500 ),
		Variables( X( :Year ), X( :Month, Position( 1 ) ), X( :Day, Position( 1 ) ), Y( Column( i ) ) ),
		Elements(
			Box Plot( X( 1 ), X( 2 ), Y, Legend( 9 ), Jitter( 1 ), Outliers( 1 ), Box Style( "Outlier" ) )
		),
		SendToReport(
			Dispatch(
				{},
				,
				ScaleBox,
				{Add Ref Line( 9, Solid, "Black", "LSL" ), Add Ref Line( 21, Solid, "Black", "USL" ),
				Add Ref Line( 16, Dashed, "Medium Dark Green", "Target" )}
			)
		),
		SendToReport(
			Dispatch(
				{},
				"graph title",
				TextEditBox,
				{Set Text( "Line " || Char( Line_Number ) || " " || Col_name )}
			)
		)
	);
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This code returns the error "Cannot find ScaleBox[ "Col_name" ] at {}", as if JSL is evaluating Col_name as a string.&lt;/P&gt;
&lt;P&gt;Any ideas on for to make Col_name evaluate to it's value, or add the ref lines differently?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jun 2018 15:36:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Reference-a-scale-box-with-a-variable/m-p/15598#M14279</guid>
      <dc:creator>bensyork</dc:creator>
      <dc:date>2018-06-25T15:36:41Z</dc:date>
    </item>
    <item>
      <title>Re: Reference a scale box with a variable</title>
      <link>https://community.jmp.com/t5/Discussions/Reference-a-scale-box-with-a-variable/m-p/15599#M14280</link>
      <description>&lt;P&gt;Forgot to add the ***, see below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For( i = 12, i &amp;lt;= 18, i++,
	Col_name = Column( i ) &amp;lt;&amp;lt; Get Name;
	temp = Expr( Col_name );
//Graph Line Data
	Split_dt &amp;lt;&amp;lt; Graph Builder(
		Size( 536, 500 ),
		Variables( X( :Year ), X( :Month, Position( 1 ) ), X( :Day, Position( 1 ) ), Y( Column( i ) ) ),
		Elements(
			Box Plot( X( 1 ), X( 2 ), And, Legend( 9 ), Jitter( 1 ), Outliers( 1 ), Box Style( "Outlier" ) )
		),
		SendToReport(
			Dispatch(
				{}, 
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;				ScaleBox,
				{Add Ref Line( 9, Solid, "Black", "LSL" ), Add Ref Line( 21, Solid, "Black", "USL" ),
				Add Ref Line( 16, Dashed, "Medium Dark Green", "Target" )}
			)
		),
		SendToReport(
			Dispatch(
				{},
				"graph title",
				TextEditBox,
				{Set Text( "Line " || Char( Line_Number ) || " " || Col_name )}
			)
		)
	);
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jun 2018 15:37:36 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Reference-a-scale-box-with-a-variable/m-p/15599#M14280</guid>
      <dc:creator>bensyork</dc:creator>
      <dc:date>2018-06-25T15:37:36Z</dc:date>
    </item>
    <item>
      <title>Re: Reference a scale box with a variable</title>
      <link>https://community.jmp.com/t5/Discussions/Reference-a-scale-box-with-a-variable/m-p/15600#M14281</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've discovered a work-around by setting spec limits for the columns I want to graph and setting show as reference lines:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="10535_pastedImage_0.png" style="width: 250px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/2459iBBB818E328B695D9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="10535_pastedImage_0.png" alt="10535_pastedImage_0.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I still don't know of any way to make the Dispatch function evaluate the variable.&amp;nbsp; It just takes it as a string.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Oct 2016 01:16:22 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Reference-a-scale-box-with-a-variable/m-p/15600#M14281</guid>
      <dc:creator>bensyork</dc:creator>
      <dc:date>2016-10-19T01:16:22Z</dc:date>
    </item>
    <item>
      <title>Re: Reference a scale box with a variable</title>
      <link>https://community.jmp.com/t5/Discussions/Reference-a-scale-box-with-a-variable/m-p/15601#M14282</link>
      <description>&lt;P&gt;Here's one way to add reference lines to an axis via JSL:&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 );
// Make some data and make a graph
dt = New Table( "Test", New Column( "Y", Numeric, Continuous, Formula( Random Normal() ) ), AddRows( 20 ) );
gb = dt &amp;lt;&amp;lt; Graph Builder(
	Size( 528, 420 ),
	Show Control Panel( 0 ),
	Variables( Y( :Y ) ),
	Elements( Points( Y, Legend( 16 ) ) ),

);
// Template expression to add a reference line
addRefLine = Expr(
	gb &amp;lt;&amp;lt; SendToReport( Dispatch( {}, "Y", ScaleBox, {Add Ref Line( TBD, "Solid", "Black", "", 1 )} ) )
);
// Loop . . .
For( i = -3, i &amp;lt;= 3, i++,
	Wait( 1 );
	Eval( Substitute( Name Expr( addRefLine ), Expr( TBD ), i ) );
);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P style="margin: 0px; font-size: 12px; line-height: normal; font-family: Courier; color: #032ce4;"&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jun 2018 15:40:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Reference-a-scale-box-with-a-variable/m-p/15601#M14282</guid>
      <dc:creator>ian_jmp</dc:creator>
      <dc:date>2018-06-25T15:40:20Z</dc:date>
    </item>
  </channel>
</rss>

