<?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 Need Help on JSL Scripting to Split Column Data with delimiter, and match with another Column delimiter Split Data in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Need-Help-on-JSL-Scripting-to-Split-Column-Data-with-delimiter/m-p/847318#M102201</link>
    <description>&lt;P&gt;Hello guys&amp;nbsp;&lt;/P&gt;&lt;P&gt;i'm using JMP17 and really need help on JSL script to process the input data below to the desired output data&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Input Data Table:&amp;nbsp;&lt;/P&gt;&lt;P&gt;| Data|&amp;nbsp; Label | ID |&lt;/P&gt;&lt;P&gt;|----------|----------|----------|&lt;/P&gt;&lt;P&gt;| 1_1_64_5_2 &amp;nbsp; | D1_DD4_FF1_FIN1_GPES2 &amp;nbsp; | Apple1 &amp;nbsp; |&lt;/P&gt;&lt;P&gt;| 1_1_2&amp;nbsp; | D2_D3_D4 &amp;nbsp; | Apple1 &amp;nbsp; |&lt;/P&gt;&lt;P&gt;| 1_2_68_5_6 &amp;nbsp; | D1_DD4_FF1_FIN1_GPES2 &amp;nbsp; | Orange1 &amp;nbsp; |&lt;/P&gt;&lt;P&gt;| 1_2_2&amp;nbsp; | D2_D3_D4 &amp;nbsp; | Orange1 &amp;nbsp; |&lt;/P&gt;&lt;P&gt;| 2_1_50_3_10 &amp;nbsp; | D1_DD4_FF1_FIN1_GPES2 &amp;nbsp; | Grape1&amp;nbsp; |&lt;/P&gt;&lt;P&gt;| 2_1_2&amp;nbsp; | D2_D3_D4 &amp;nbsp; | Grape1&amp;nbsp; |&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Output Format: (column sequence arrangement does not matter)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;| ID|&amp;nbsp; Label| Data|&lt;/P&gt;&lt;P&gt;|----------|----------|----------|&lt;/P&gt;&lt;P&gt;| Apple1&amp;nbsp; | D1 &amp;nbsp; | 1 &amp;nbsp; |&lt;/P&gt;&lt;P&gt;| Apple1&amp;nbsp; | DD4 &amp;nbsp; | 1 &amp;nbsp; |&lt;/P&gt;&lt;P&gt;| Apple1&amp;nbsp; | FF1 &amp;nbsp; | 64 |&lt;/P&gt;&lt;P&gt;| Apple1&amp;nbsp; | FIN1&amp;nbsp; | 5&amp;nbsp;&amp;nbsp; |&lt;/P&gt;&lt;P&gt;| Apple1&amp;nbsp; | GPES2&amp;nbsp; | 2 &amp;nbsp; |&lt;/P&gt;&lt;P&gt;| Apple1&amp;nbsp; | D2| 1 |&lt;/P&gt;&lt;P&gt;| Apple1&amp;nbsp; | D3| 1&amp;nbsp;&amp;nbsp; |&lt;/P&gt;&lt;P&gt;| Apple1&amp;nbsp; | D4 &amp;nbsp; | 2 &amp;nbsp; |&lt;/P&gt;&lt;P&gt;| Orange1| D1 &amp;nbsp; | 1 &amp;nbsp; |&lt;/P&gt;&lt;P&gt;| Orange1| DD4 &amp;nbsp; | 2|&lt;/P&gt;&lt;P&gt;| Orange1| FF1 &amp;nbsp; | 68|&lt;/P&gt;&lt;P&gt;| Orange1| FIN1&amp;nbsp; | 5&amp;nbsp;&amp;nbsp; |&lt;/P&gt;&lt;P&gt;| Orange1| GPES2&amp;nbsp; | 6 &amp;nbsp; |&lt;/P&gt;&lt;P&gt;| Orange1| D2| 1 |&lt;/P&gt;&lt;P&gt;| Orange1| D3| 2&amp;nbsp;&amp;nbsp; |&lt;/P&gt;&lt;P&gt;| Orange1| D4 &amp;nbsp; | 2 &amp;nbsp; |&lt;/P&gt;&lt;P&gt;| Grape1&amp;nbsp; | D1 &amp;nbsp; | 2 &amp;nbsp; |&lt;/P&gt;&lt;P&gt;| Grape1&amp;nbsp; | DD4 &amp;nbsp; | 1|&lt;/P&gt;&lt;P&gt;| Grape1&amp;nbsp; | FF1 &amp;nbsp; | 50|&lt;/P&gt;&lt;P&gt;| Grape1&amp;nbsp; | FIN1&amp;nbsp; | 3&amp;nbsp;&amp;nbsp; |&lt;/P&gt;&lt;P&gt;| Grape1&amp;nbsp; | GPES2&amp;nbsp; | 10 &amp;nbsp; |&lt;/P&gt;&lt;P&gt;| Grape1&amp;nbsp; | D2| 2 |&lt;/P&gt;&lt;P&gt;| Grape1&amp;nbsp; | D3| 1&amp;nbsp;&amp;nbsp; |&lt;/P&gt;&lt;P&gt;| Grape1&amp;nbsp; | D4 &amp;nbsp; | 2 &amp;nbsp; |&lt;/P&gt;</description>
    <pubDate>Tue, 11 Mar 2025 14:00:57 GMT</pubDate>
    <dc:creator>CohortOpossum40</dc:creator>
    <dc:date>2025-03-11T14:00:57Z</dc:date>
    <item>
      <title>Need Help on JSL Scripting to Split Column Data with delimiter, and match with another Column delimiter Split Data</title>
      <link>https://community.jmp.com/t5/Discussions/Need-Help-on-JSL-Scripting-to-Split-Column-Data-with-delimiter/m-p/847318#M102201</link>
      <description>&lt;P&gt;Hello guys&amp;nbsp;&lt;/P&gt;&lt;P&gt;i'm using JMP17 and really need help on JSL script to process the input data below to the desired output data&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Input Data Table:&amp;nbsp;&lt;/P&gt;&lt;P&gt;| Data|&amp;nbsp; Label | ID |&lt;/P&gt;&lt;P&gt;|----------|----------|----------|&lt;/P&gt;&lt;P&gt;| 1_1_64_5_2 &amp;nbsp; | D1_DD4_FF1_FIN1_GPES2 &amp;nbsp; | Apple1 &amp;nbsp; |&lt;/P&gt;&lt;P&gt;| 1_1_2&amp;nbsp; | D2_D3_D4 &amp;nbsp; | Apple1 &amp;nbsp; |&lt;/P&gt;&lt;P&gt;| 1_2_68_5_6 &amp;nbsp; | D1_DD4_FF1_FIN1_GPES2 &amp;nbsp; | Orange1 &amp;nbsp; |&lt;/P&gt;&lt;P&gt;| 1_2_2&amp;nbsp; | D2_D3_D4 &amp;nbsp; | Orange1 &amp;nbsp; |&lt;/P&gt;&lt;P&gt;| 2_1_50_3_10 &amp;nbsp; | D1_DD4_FF1_FIN1_GPES2 &amp;nbsp; | Grape1&amp;nbsp; |&lt;/P&gt;&lt;P&gt;| 2_1_2&amp;nbsp; | D2_D3_D4 &amp;nbsp; | Grape1&amp;nbsp; |&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Output Format: (column sequence arrangement does not matter)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;| ID|&amp;nbsp; Label| Data|&lt;/P&gt;&lt;P&gt;|----------|----------|----------|&lt;/P&gt;&lt;P&gt;| Apple1&amp;nbsp; | D1 &amp;nbsp; | 1 &amp;nbsp; |&lt;/P&gt;&lt;P&gt;| Apple1&amp;nbsp; | DD4 &amp;nbsp; | 1 &amp;nbsp; |&lt;/P&gt;&lt;P&gt;| Apple1&amp;nbsp; | FF1 &amp;nbsp; | 64 |&lt;/P&gt;&lt;P&gt;| Apple1&amp;nbsp; | FIN1&amp;nbsp; | 5&amp;nbsp;&amp;nbsp; |&lt;/P&gt;&lt;P&gt;| Apple1&amp;nbsp; | GPES2&amp;nbsp; | 2 &amp;nbsp; |&lt;/P&gt;&lt;P&gt;| Apple1&amp;nbsp; | D2| 1 |&lt;/P&gt;&lt;P&gt;| Apple1&amp;nbsp; | D3| 1&amp;nbsp;&amp;nbsp; |&lt;/P&gt;&lt;P&gt;| Apple1&amp;nbsp; | D4 &amp;nbsp; | 2 &amp;nbsp; |&lt;/P&gt;&lt;P&gt;| Orange1| D1 &amp;nbsp; | 1 &amp;nbsp; |&lt;/P&gt;&lt;P&gt;| Orange1| DD4 &amp;nbsp; | 2|&lt;/P&gt;&lt;P&gt;| Orange1| FF1 &amp;nbsp; | 68|&lt;/P&gt;&lt;P&gt;| Orange1| FIN1&amp;nbsp; | 5&amp;nbsp;&amp;nbsp; |&lt;/P&gt;&lt;P&gt;| Orange1| GPES2&amp;nbsp; | 6 &amp;nbsp; |&lt;/P&gt;&lt;P&gt;| Orange1| D2| 1 |&lt;/P&gt;&lt;P&gt;| Orange1| D3| 2&amp;nbsp;&amp;nbsp; |&lt;/P&gt;&lt;P&gt;| Orange1| D4 &amp;nbsp; | 2 &amp;nbsp; |&lt;/P&gt;&lt;P&gt;| Grape1&amp;nbsp; | D1 &amp;nbsp; | 2 &amp;nbsp; |&lt;/P&gt;&lt;P&gt;| Grape1&amp;nbsp; | DD4 &amp;nbsp; | 1|&lt;/P&gt;&lt;P&gt;| Grape1&amp;nbsp; | FF1 &amp;nbsp; | 50|&lt;/P&gt;&lt;P&gt;| Grape1&amp;nbsp; | FIN1&amp;nbsp; | 3&amp;nbsp;&amp;nbsp; |&lt;/P&gt;&lt;P&gt;| Grape1&amp;nbsp; | GPES2&amp;nbsp; | 10 &amp;nbsp; |&lt;/P&gt;&lt;P&gt;| Grape1&amp;nbsp; | D2| 2 |&lt;/P&gt;&lt;P&gt;| Grape1&amp;nbsp; | D3| 1&amp;nbsp;&amp;nbsp; |&lt;/P&gt;&lt;P&gt;| Grape1&amp;nbsp; | D4 &amp;nbsp; | 2 &amp;nbsp; |&lt;/P&gt;</description>
      <pubDate>Tue, 11 Mar 2025 14:00:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Need-Help-on-JSL-Scripting-to-Split-Column-Data-with-delimiter/m-p/847318#M102201</guid>
      <dc:creator>CohortOpossum40</dc:creator>
      <dc:date>2025-03-11T14:00:57Z</dc:date>
    </item>
    <item>
      <title>Re: Need Help on JSL Scripting to Split Column Data with delimiter, and match with another Column delimiter Split Data</title>
      <link>https://community.jmp.com/t5/Discussions/Need-Help-on-JSL-Scripting-to-Split-Column-Data-with-delimiter/m-p/847338#M102203</link>
      <description>&lt;P&gt;Can you provide example table? It is a bit difficult to understand the starting situation from just text.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Mar 2025 14:18:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Need-Help-on-JSL-Scripting-to-Split-Column-Data-with-delimiter/m-p/847338#M102203</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-03-11T14:18:42Z</dc:date>
    </item>
    <item>
      <title>Re: Need Help on JSL Scripting to Split Column Data with delimiter, and match with another Column delimiter Split Data</title>
      <link>https://community.jmp.com/t5/Discussions/Need-Help-on-JSL-Scripting-to-Split-Column-Data-with-delimiter/m-p/847339#M102204</link>
      <description>&lt;P&gt;I'm assuming that all of the label and data values have the same number of items in there. If so, this would work. If not, there would need to be a little more logic added to check for that, but this would be a quick way to process your data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// this would be whatever your input table name is&lt;BR /&gt;dt0 = Data table("Input Table");

dt1 = new table("Output table");
dt1&amp;lt;&amp;lt;New Column("ID", Character);
dt1&amp;lt;&amp;lt;New column("Label", Character);
dt1&amp;lt;&amp;lt;New Column("Data", Character);

current data table(dt0);
for each row(
	idvar = dt0:ID;
	list1 = words(dt0:data,"_");
	list2 = words(dt0:label,"_");

	current data table(dt1);
	for(i=1, i&amp;lt;=Nitems(list1), i++,
		dt1&amp;lt;&amp;lt;add rows(1);
		dt1:ID=idvar;

		dt1:label = list2[i];
		dt1:data = list1[i];
	);
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Mar 2025 14:19:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Need-Help-on-JSL-Scripting-to-Split-Column-Data-with-delimiter/m-p/847339#M102204</guid>
      <dc:creator>bfoulkes</dc:creator>
      <dc:date>2025-03-11T14:19:06Z</dc:date>
    </item>
    <item>
      <title>Re: Need Help on JSL Scripting to Split Column Data with delimiter, and match with another Column delimiter Split Data</title>
      <link>https://community.jmp.com/t5/Discussions/Need-Help-on-JSL-Scripting-to-Split-Column-Data-with-delimiter/m-p/848031#M102311</link>
      <description>&lt;P&gt;I'm not sure what is the starting point, so I will assume you have a data table and not text file.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1742114281104.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/73910i00B3F36FC449B85F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1742114281104.png" alt="jthi_0-1742114281104.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Pick Data and Label column and use Text to Columns on them&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_1-1742114346080.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/73911i5739D29FBB7B6841/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_1-1742114346080.png" alt="jthi_1-1742114346080.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Remove those "old" columns (or move them to end).&lt;/P&gt;
&lt;P&gt;Next stack your data using multiple series stack&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_2-1742114445416.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/73912iB5D05E51DE04B10E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_2-1742114445416.png" alt="jthi_2-1742114445416.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Delete extra columns, reorder and rename columns&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_3-1742114484301.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/73913iCA96D7EB09FA0372/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_3-1742114484301.png" alt="jthi_3-1742114484301.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Drop missing rows&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_4-1742114528652.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/73914iBE92720FCAC7BAE8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_4-1742114528652.png" alt="jthi_4-1742114528652.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Verify results and take the script JMP created for you (or workflow).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Workflow is also attached (might require some cleanup) and cleaned script based on the workflow below (can be made much more robust depending on your needs):&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = Current Data Table();
dt &amp;lt;&amp;lt; Text to Columns(columns(:" Data"n, :Label), Delimiters("_"));
dt &amp;lt;&amp;lt; Delete Columns(:" Data"n, :Label);

dt_stacked = dt &amp;lt;&amp;lt; Stack(
	columns(:Data 1, :Data 2, :Data 3, :Data 4, :Data 5, :Label 1, :Label 2, :Label 3, :Label 4, :Label 5),
	Number of Series(2),
	Contiguous,
	Output Table("Stacked result")
);

dt_stacked &amp;lt;&amp;lt; Delete Columns(:Label, :Label 2);

Column(dt_stacked, "Data 2") &amp;lt;&amp;lt; Set Name("Label");
dt_stacked &amp;lt;&amp;lt; Move Selected Columns({:Label}, after(:ID));

dt_stacked &amp;lt;&amp;lt; Select Where(:Label == "") &amp;lt;&amp;lt; Delete Rows;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/LI-SPOILER&gt;</description>
      <pubDate>Sun, 16 Mar 2025 08:49:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Need-Help-on-JSL-Scripting-to-Split-Column-Data-with-delimiter/m-p/848031#M102311</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-03-16T08:49:30Z</dc:date>
    </item>
    <item>
      <title>Re: Need Help on JSL Scripting to Split Column Data with delimiter, and match with another Column delimiter Split Data</title>
      <link>https://community.jmp.com/t5/Discussions/Need-Help-on-JSL-Scripting-to-Split-Column-Data-with-delimiter/m-p/848032#M102312</link>
      <description>&lt;P&gt;Few improvements I would suggest:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Generally don't use Current Data Table(). In this case you could potentially pick the initial table using it but you shouldn't need to keep changing it around as you already have the references (for example &lt;EM&gt;current data table(dt1); &lt;/EM&gt;is unnecessary and could cause issues)&lt;/LI&gt;
&lt;LI&gt;Loop over specific table when using For Each Row and do not rely on what ever the current table is (for each row(dt0,...)&lt;/LI&gt;
&lt;LI&gt;You can also use For Each + Across to loop over multiple containers. You can also force different behaviors when using Across to handle different length containers&lt;/LI&gt;
&lt;LI&gt;If you know the column names + values, you can add values already with &amp;lt;&amp;lt; Add rows but it can be a mess (usually I add row like you did and add values after)&lt;/LI&gt;
&lt;/OL&gt;
&lt;LI-SPOILER&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt_input = Current Data Table(); 
// dt_input = Data table("Input Table");

dt_result = New Table("Output table");
dt_result &amp;lt;&amp;lt; New Column("ID", Character, Nominal);
dt_result &amp;lt;&amp;lt; New column("Label", Character, Nominal);
dt_result &amp;lt;&amp;lt; New Column("Data", Character, Nominal);

For Each Row(dt_input,
	id_val = Column(dt_input, "ID")[];
	data_vals = Words(Column(dt_input, "Data")[], "_");
	label_vals = Words(Column(dt_input, "Label")[], "_");
	
	For Each({{cur_label, cur_data}}, Across(label_vals, data_vals),
		dt_result &amp;lt;&amp;lt; Add Rows({ID = id_val, Label = cur_label, Data = cur_data});
	);
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/LI-SPOILER&gt;</description>
      <pubDate>Sun, 16 Mar 2025 09:07:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Need-Help-on-JSL-Scripting-to-Split-Column-Data-with-delimiter/m-p/848032#M102312</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-03-16T09:07:41Z</dc:date>
    </item>
  </channel>
</rss>

