<?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: Stack Multiple Parameter with condition with JSL in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Stack-Multiple-Parameter-with-condition-with-JSL/m-p/224192#M44555</link>
    <description>&lt;P&gt;Thanks pmroz. I modified the script according to your suggestion, but seem like running into error.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

sourceTable = Data Table( "FINAL" );

col_list = sourceTable &amp;lt;&amp;lt; get column names( continuous );
stackcols = {};
one_col = {};

For( i = 1, i &amp;lt;= N Items( col_list ), i++,
	one_col = col_list[i];
	If( Regex( one_col, "(\d+);(\S+)" ) == one_col,
		Insert Into( stackcols, one_col )
	);
);

resultTable = sourceTable &amp;lt;&amp;lt; Stack(
	columns( stackcols ),
	Source Label Column( "Label" ),
	Stacked Data Column( "Data" )
);
resultTable &amp;lt;&amp;lt; setName( (sourceTable &amp;lt;&amp;lt; getName) || " Stacked Data" );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;/***********************************&lt;BR /&gt;Unknown error in pattern match in access or evaluation of 'Regex' , Regex/*###*/(one_col, "(\d+);(\S+)")&lt;/P&gt;</description>
    <pubDate>Fri, 30 Aug 2019 11:53:23 GMT</pubDate>
    <dc:creator>OneNorthJMP</dc:creator>
    <dc:date>2019-08-30T11:53:23Z</dc:date>
    <item>
      <title>Stack Multiple Parameter with condition with JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Stack-Multiple-Parameter-with-condition-with-JSL/m-p/224049#M44532</link>
      <description>&lt;P&gt;I got a dataset with multiple parameters with certain format "TestNumber;TestName". I know we can easily to it manually. But&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to stack them all with JSL in a smart way. How to do this in JSL ? Please advise. Thanks&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Aug 2019 06:19:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Stack-Multiple-Parameter-with-condition-with-JSL/m-p/224049#M44532</guid>
      <dc:creator>OneNorthJMP</dc:creator>
      <dc:date>2019-08-29T06:19:21Z</dc:date>
    </item>
    <item>
      <title>Re: Stack Multiple Parameter with condition with JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Stack-Multiple-Parameter-with-condition-with-JSL/m-p/224061#M44533</link>
      <description>&lt;P&gt;If you can, it's a good idea to let JMP do the work for you - Generally you only need to do things 'by hand' once, then use the code that JMP generates automatically.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In you case, if you do 'Tables &amp;gt; Stack':&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2019-08-29 at 10.02.00.png" style="width: 945px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/19061iBA631D88C0CD9EBA/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2019-08-29 at 10.02.00.png" alt="Screen Shot 2019-08-29 at 10.02.00.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;hitting 'OK' gives a new table that has a saved script called 'Source'. If you right-click on the associated green 'run' icon, you can select 'Edit', which will give you this script:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Data Table( "FINAL.jmp" ) &amp;lt;&amp;lt; Stack(
	columns(
		:Name( "2010;PinShort@CLK" ),
		:Name( "2011;PinShort@IO" ),
		:Name( "2012;PinShort@VDD" ),
		:Name( "2013;PinShort@LA" ),
		:Name( "2014;PinShort@LB" ),
		:Name( "2030;PinOpen@CLK" ),
		:Name( "2031;PinOpen@IO" ),
		:Name( "2032;PinOpen@VDD" ),
		:Name( "2033;PinOpen@LA" ),
		:Name( "2034;PinOpen@LB" ),
		:Name( "2200;Ana_Idd_noClock@VDD" ),
		:Name( "2360;Dig_ATE_FUN_00_001_Authenticate" ),
		:Name( "2361;Dig_ATE_FUN_00_003_DisableReset" ),
		:Name( "2380;Dig_ATE_FUN_00_004_GetVersion" ),
		:Name( "2440;SyncPulse_and_capResponse_0x90" ),
		:Name( "2441;Ana_Pads_ATE_VOL_0uA@IO" ),
		:Name( "2442;Ana_Pads_ATE_VOH_0uA@IO" ),
		:Name( "2443;Ana_Pads_ATE_VOL_0uA_IDD@VDD" ),
		:Name( "2444;Ana_Pads_ATE_VOL_0uA_Rcont_GND@VSS" )
	),
	Source Label Column( "Label" ),
	Stacked Data Column( "Data" )
)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can make this script smarter, but if you are just adding new rows it will work fine (so long as the columns it needs are still in the source table).&lt;/P&gt;</description>
      <pubDate>Thu, 29 Aug 2019 09:08:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Stack-Multiple-Parameter-with-condition-with-JSL/m-p/224061#M44533</guid>
      <dc:creator>ian_jmp</dc:creator>
      <dc:date>2019-08-29T09:08:55Z</dc:date>
    </item>
    <item>
      <title>Re: Stack Multiple Parameter with condition with JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Stack-Multiple-Parameter-with-condition-with-JSL/m-p/224103#M44539</link>
      <description>Hi Ian,&lt;BR /&gt;&lt;BR /&gt;I know this already. The things is my table is dynamic. I don't want to modify my script every time i have different data table. But my parametric data format is fix. So, it should have be an intelligent way to code this in JSL.</description>
      <pubDate>Thu, 29 Aug 2019 13:42:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Stack-Multiple-Parameter-with-condition-with-JSL/m-p/224103#M44539</guid>
      <dc:creator>OneNorthJMP</dc:creator>
      <dc:date>2019-08-29T13:42:29Z</dc:date>
    </item>
    <item>
      <title>Re: Stack Multiple Parameter with condition with JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Stack-Multiple-Parameter-with-condition-with-JSL/m-p/224106#M44542</link>
      <description>&lt;P&gt;Details will depend on exactly what you mean when you say 'my table is dynamic', and how much intelligence you require.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But, for instance, making some small changes to the JMP generated code, you could have;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;NamesDefaultToHere(1);

sourceTable = DataTable("FINAL");
stackCols = 
{
		:Name( "2010;PinShort@CLK" ),
		:Name( "2011;PinShort@IO" ),
		:Name( "2012;PinShort@VDD" ),
		:Name( "2013;PinShort@LA" ),
		:Name( "2014;PinShort@LB" ),
		:Name( "2030;PinOpen@CLK" ),
		:Name( "2031;PinOpen@IO" ),
		:Name( "2032;PinOpen@VDD" ),
		:Name( "2033;PinOpen@LA" ),
		:Name( "2034;PinOpen@LB" ),
		:Name( "2200;Ana_Idd_noClock@VDD" ),
		:Name( "2360;Dig_ATE_FUN_00_001_Authenticate" ),
		:Name( "2361;Dig_ATE_FUN_00_003_DisableReset" ),
		:Name( "2380;Dig_ATE_FUN_00_004_GetVersion" ),
		:Name( "2440;SyncPulse_and_capResponse_0x90" ),
		:Name( "2441;Ana_Pads_ATE_VOL_0uA@IO" ),
		:Name( "2442;Ana_Pads_ATE_VOH_0uA@IO" ),
		:Name( "2443;Ana_Pads_ATE_VOL_0uA_IDD@VDD" ),
		:Name( "2444;Ana_Pads_ATE_VOL_0uA_Rcont_GND@VSS" )

};
resultTable = sourceTable &amp;lt;&amp;lt; Stack(columns(stackCols), Source Label Column( "Label" ), Stacked Data Column( "Data" ));
resultTable &amp;lt;&amp;lt; setName((sourceTable &amp;lt;&amp;lt; getName)||" Stacked Data");&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The values of 'sourceTable' and 'stackCols' would be set by a user interface, or some larger JSL script.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Aug 2019 14:09:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Stack-Multiple-Parameter-with-condition-with-JSL/m-p/224106#M44542</guid>
      <dc:creator>ian_jmp</dc:creator>
      <dc:date>2019-08-29T14:09:26Z</dc:date>
    </item>
    <item>
      <title>Re: Stack Multiple Parameter with condition with JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Stack-Multiple-Parameter-with-condition-with-JSL/m-p/224187#M44551</link>
      <description>&lt;P&gt;Hi Ian,&lt;BR /&gt;&lt;BR /&gt;Thanks for reply. Maybe my explanation is not clear. I want to have JSL script can adapt different parameters from different input table.&lt;BR /&gt;&lt;BR /&gt;For example, input table 1, i have 2 columns. I have to modified the JSL to below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Data Table( "FINAL.jmp" ) &amp;lt;&amp;lt; Stack(
	columns(
		:Name( "2010;PinShort@CLK" ),
		:Name( "2011;PinShort@IO" ),
		:Name( "2012;PinShort@VDD" ),
		:Name( "2013;PinShort@LA" ),
		:Name( "2014;PinShort@LB" ),
		:Name( "2030;PinOpen@CLK" )
	),
	Source Label Column( "Label" ),
	Stacked Data Column( "Data" )
)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;For example, input table 2, if i have 3 columns. I have to modified the JSL to below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Data Table( "FINAL.jmp" ) &amp;lt;&amp;lt; Stack(
	columns( :Name( "2010;PinShort@CLK" ), :Name( "2011;PinShort@IO" ), :Name( "2012;PinShort@VDD" ), ),
	Source Label Column( "Label" ),
	Stacked Data Column( "Data" )
)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;Then, what if i have thousand columns? Then i have to manually key in this one by one? or do this manually? Yes, of course i can do it manually. But that is not my objective, i want to have a script to can read the regular expression to find stack the parameters "(\d+);(\S+)" no matter what is my input table is.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Aug 2019 11:51:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Stack-Multiple-Parameter-with-condition-with-JSL/m-p/224187#M44551</guid>
      <dc:creator>OneNorthJMP</dc:creator>
      <dc:date>2019-08-30T11:51:54Z</dc:date>
    </item>
    <item>
      <title>Re: Stack Multiple Parameter with condition with JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Stack-Multiple-Parameter-with-condition-with-JSL/m-p/224188#M44552</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/11023"&gt;@OneNorthJMP&lt;/a&gt; ,&lt;/P&gt;
&lt;P&gt;I believe that what Ian showed you is what you are asking for.&amp;nbsp; What Ian showed is that is what you need to do, is to create a list (stackCols) in your JSL that contains the names of the columns you want stacked, and then run the piece of code at the bottom of his script:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;resultTable = sourceTable &amp;lt;&amp;lt; Stack(columns(stackCols), Source Label Column( "Label" ), Stacked Data Column( "Data" ));
resultTable &amp;lt;&amp;lt; setName((sourceTable &amp;lt;&amp;lt; getName)||" Stacked Data");&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So, the issue is for you to populate the stackCols list.&amp;nbsp; How you do that is unique to your needs.&amp;nbsp; It may be as easy as to use&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;stackCols = dt &amp;lt;&amp;lt; get column names( continuous );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;to populate the list.&amp;nbsp; Or it may require a more complex methodology.&amp;nbsp; But what Ian showed, is how simple it is to run the Stack Platform with whatever data that you currently have in your data table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Aug 2019 02:00:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Stack-Multiple-Parameter-with-condition-with-JSL/m-p/224188#M44552</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2019-08-30T02:00:20Z</dc:date>
    </item>
    <item>
      <title>Re: Stack Multiple Parameter with condition with JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Stack-Multiple-Parameter-with-condition-with-JSL/m-p/224189#M44553</link>
      <description>Hi Nelson,&lt;BR /&gt;&lt;BR /&gt;I fully understand. And yet my issue is exactly what you mention above, "how to populate the stackCols list" with my condition with parametric with regular expression "(\d+);(\S+)".&lt;BR /&gt;&lt;BR /&gt;Thanks anyway. I will try to trial and error myself.</description>
      <pubDate>Fri, 30 Aug 2019 02:11:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Stack-Multiple-Parameter-with-condition-with-JSL/m-p/224189#M44553</guid>
      <dc:creator>OneNorthJMP</dc:creator>
      <dc:date>2019-08-30T02:11:05Z</dc:date>
    </item>
    <item>
      <title>Re: Stack Multiple Parameter with condition with JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Stack-Multiple-Parameter-with-condition-with-JSL/m-p/224190#M44554</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;col_list = {"2010;PinShort@CLK", "2011;PinShort@IO", "2012;PinShort@VDD", "Label", "Data"};
stackcols = {};

for (i = 1, i &amp;lt;= nitems(col_list), i++,
	one_col = col_list[i];
	if (regex(one_col, "(\d+);(\S+)") == one_col,
		insertinto(stackcols, one_col);
	);
);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 30 Aug 2019 02:30:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Stack-Multiple-Parameter-with-condition-with-JSL/m-p/224190#M44554</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2019-08-30T02:30:00Z</dc:date>
    </item>
    <item>
      <title>Re: Stack Multiple Parameter with condition with JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Stack-Multiple-Parameter-with-condition-with-JSL/m-p/224192#M44555</link>
      <description>&lt;P&gt;Thanks pmroz. I modified the script according to your suggestion, but seem like running into error.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

sourceTable = Data Table( "FINAL" );

col_list = sourceTable &amp;lt;&amp;lt; get column names( continuous );
stackcols = {};
one_col = {};

For( i = 1, i &amp;lt;= N Items( col_list ), i++,
	one_col = col_list[i];
	If( Regex( one_col, "(\d+);(\S+)" ) == one_col,
		Insert Into( stackcols, one_col )
	);
);

resultTable = sourceTable &amp;lt;&amp;lt; Stack(
	columns( stackcols ),
	Source Label Column( "Label" ),
	Stacked Data Column( "Data" )
);
resultTable &amp;lt;&amp;lt; setName( (sourceTable &amp;lt;&amp;lt; getName) || " Stacked Data" );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;/***********************************&lt;BR /&gt;Unknown error in pattern match in access or evaluation of 'Regex' , Regex/*###*/(one_col, "(\d+);(\S+)")&lt;/P&gt;</description>
      <pubDate>Fri, 30 Aug 2019 11:53:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Stack-Multiple-Parameter-with-condition-with-JSL/m-p/224192#M44555</guid>
      <dc:creator>OneNorthJMP</dc:creator>
      <dc:date>2019-08-30T11:53:23Z</dc:date>
    </item>
    <item>
      <title>Re: Stack Multiple Parameter with condition with JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Stack-Multiple-Parameter-with-condition-with-JSL/m-p/224231#M44563</link>
      <description>&lt;P&gt;You needed to convert the column names to a string.&amp;nbsp; Also one_col is not a list.&amp;nbsp; Here's the corrected code.&amp;nbsp; I encourage you to&amp;nbsp;&lt;/P&gt;
&lt;P&gt;a) Read the scripting manuals&lt;/P&gt;
&lt;P&gt;b) Check the log frequently for variable values, error messages etc.&lt;/P&gt;
&lt;P&gt;c) Keep using this discussion forum&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 );

sourceTable = Data Table( "FINAL" );

col_list = sourceTable &amp;lt;&amp;lt; get column names( continuous, string );
stackcols = {};
//one_col = {};

For( i = 1, i &amp;lt;= N Items( col_list ), i++,
	one_col = col_list[i];
	show(one_col, i);
	If( Regex( one_col, "(\d+);(\S+)" ) == one_col,
		Insert Into( stackcols, one_col )
	);
);

resultTable = sourceTable &amp;lt;&amp;lt; Stack(
	columns( stackcols ),
	Source Label Column( "Label" ),
	Stacked Data Column( "Data" )
);
resultTable &amp;lt;&amp;lt; setName( (sourceTable &amp;lt;&amp;lt; getName) || " Stacked Data" );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 30 Aug 2019 14:20:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Stack-Multiple-Parameter-with-condition-with-JSL/m-p/224231#M44563</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2019-08-30T14:20:41Z</dc:date>
    </item>
    <item>
      <title>Re: Stack Multiple Parameter with condition with JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Stack-Multiple-Parameter-with-condition-with-JSL/m-p/224297#M44581</link>
      <description>Hi promz,&lt;BR /&gt;&lt;BR /&gt;Thanks for great tips! It work like champ!</description>
      <pubDate>Mon, 02 Sep 2019 00:44:19 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Stack-Multiple-Parameter-with-condition-with-JSL/m-p/224297#M44581</guid>
      <dc:creator>OneNorthJMP</dc:creator>
      <dc:date>2019-09-02T00:44:19Z</dc:date>
    </item>
  </channel>
</rss>

