<?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 Using a variable for multiple commands in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Using-a-variable-for-multiple-commands/m-p/763029#M94378</link>
    <description>&lt;P&gt;Hi All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am looking for a way to use one variable in place of the individual commands in place of the multiple command lines. When I run this the Stacking window opens rather then executing the other commands included in the variable. I've also tried using combinations of EVAL() and PARSE() but with no better results.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I apologize if the terminology I've used isn't correct.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any help!&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;test_variable = "columns( :Column1, :Column2 ),
	Source Label Column( \!"Label\!" ),
	Stacked Data Column( \!"Data\!" ),
	Move Columns( To First ),
	Output Table ( \!"Test Output Table\!" )";

current data table () &amp;lt;&amp;lt; Stack (test_variable);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 10 Jun 2024 16:49:08 GMT</pubDate>
    <dc:creator>Mad_dog_550</dc:creator>
    <dc:date>2024-06-10T16:49:08Z</dc:date>
    <item>
      <title>Using a variable for multiple commands</title>
      <link>https://community.jmp.com/t5/Discussions/Using-a-variable-for-multiple-commands/m-p/763029#M94378</link>
      <description>&lt;P&gt;Hi All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am looking for a way to use one variable in place of the individual commands in place of the multiple command lines. When I run this the Stacking window opens rather then executing the other commands included in the variable. I've also tried using combinations of EVAL() and PARSE() but with no better results.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I apologize if the terminology I've used isn't correct.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any help!&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;test_variable = "columns( :Column1, :Column2 ),
	Source Label Column( \!"Label\!" ),
	Stacked Data Column( \!"Data\!" ),
	Move Columns( To First ),
	Output Table ( \!"Test Output Table\!" )";

current data table () &amp;lt;&amp;lt; Stack (test_variable);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 10 Jun 2024 16:49:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Using-a-variable-for-multiple-commands/m-p/763029#M94378</guid>
      <dc:creator>Mad_dog_550</dc:creator>
      <dc:date>2024-06-10T16:49:08Z</dc:date>
    </item>
    <item>
      <title>Re: Using a variable for multiple commands</title>
      <link>https://community.jmp.com/t5/Discussions/Using-a-variable-for-multiple-commands/m-p/763032#M94380</link>
      <description>&lt;P&gt;What are you trying to do exactly? Use same selections in stack multiple times?&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2024 16:58:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Using-a-variable-for-multiple-commands/m-p/763032#M94380</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-06-10T16:58:18Z</dc:date>
    </item>
    <item>
      <title>Re: Using a variable for multiple commands</title>
      <link>https://community.jmp.com/t5/Discussions/Using-a-variable-for-multiple-commands/m-p/763045#M94382</link>
      <description>&lt;P&gt;I picked the Stack because it seemed like a simpler example of what I was trying to accomplish.&amp;nbsp; Ultimately, I wanted to use a variable to be used as a substitute for a block of command text in formatting a bunch of control charts.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2024 18:10:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Using-a-variable-for-multiple-commands/m-p/763045#M94382</guid>
      <dc:creator>Mad_dog_550</dc:creator>
      <dc:date>2024-06-10T18:10:14Z</dc:date>
    </item>
    <item>
      <title>Re: Using a variable for multiple commands</title>
      <link>https://community.jmp.com/t5/Discussions/Using-a-variable-for-multiple-commands/m-p/763048#M94385</link>
      <description>&lt;P&gt;Usually you can build them in other ways (expressions) than using just strings (and I would say if you can, you should).&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2024 19:08:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Using-a-variable-for-multiple-commands/m-p/763048#M94385</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-06-10T19:08:42Z</dc:date>
    </item>
    <item>
      <title>Re: Using a variable for multiple commands</title>
      <link>https://community.jmp.com/t5/Discussions/Using-a-variable-for-multiple-commands/m-p/763051#M94387</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;Usually you can build them in other ways (expressions) than using just strings (and I would say if you can, you should).&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;One approach is to use a placeholder ( _cols_ ) - and then replace (&lt;FONT face="courier new,courier"&gt;substitute&lt;/FONT&gt;) it with your pre-configured expression - like here:&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" );

cols = Expr(Columns(:height, :weight));

mycommand = Expr(current data table () &amp;lt;&amp;lt; Stack (_cols_, Source Label Column( "Label" ),
	Stacked Data Column( "Data" ),
	Move Columns( To First ),
	Output Table ( "Test Output Table" )));
	
Eval (Substitute ( Name Expr(mycommand),Expr(_cols_), Name Expr (cols) ))&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Some &lt;FONT face="courier new,courier"&gt;Expr()&lt;/FONT&gt; and &lt;FONT face="courier new,courier"&gt;Name Expr()&lt;/FONT&gt; "magic" is necessary to prevent JMP from executing expressions at the wrong time [&lt;FONT face="courier new,courier"&gt;Expr()&lt;/FONT&gt;] -&amp;nbsp; and to get access to the expression (&lt;FONT face="courier new,courier"&gt;Name Expr()&lt;/FONT&gt;) which is stored inside a variable (&lt;FONT face="courier new,courier"&gt;name&lt;/FONT&gt;) instead of the &lt;FONT face="courier new,courier"&gt;name&lt;/FONT&gt; itself.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At first sight, a user will decide that it's better to live without this overhead - or to use &lt;FONT face="courier new,courier"&gt;Eval(Parse(String))&lt;/FONT&gt; as a fallback solution. But it's a good idea to invest some time here, e.g. with the help of this great lecture:&amp;nbsp;&lt;BR /&gt;&lt;LI-MESSAGE title="Using JSL to Develop Efficient, Robust Applications (EU 2018 415)" uid="51456" url="https://community.jmp.com/t5/Discovery-Summit-Europe-2018/Using-JSL-to-Develop-Efficient-Robust-Applications-EU-2018-415/m-p/51456#U51456" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-tkb-thread lia-fa-icon lia-fa-tkb lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2024 19:56:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Using-a-variable-for-multiple-commands/m-p/763051#M94387</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2024-06-10T19:56:13Z</dc:date>
    </item>
  </channel>
</rss>

