<?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: Reorganizing A Table by Items Within A Column in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Reorganizing-A-Table-by-Items-Within-A-Column/m-p/466063#M70985</link>
    <description>&lt;P&gt;This is a brute-force approach, but it works.&amp;nbsp; Note the variables for split columns and nonsplit columns.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = New Table( "Base Tire Data", Add Rows( 4 ),
	New Column( "Tire ID", Numeric, "Continuous", Format( "Best", 12 ),
		Set Values( [2326, 2326, 2327, 2327] ) ),
	New Column( "Tread", Character( 16 ), "Nominal",
		Set Values( {"Inner", "Outer", "Inner", "Outer"} ) ),
	New Column( "Depth", Numeric, "Continuous", Format( "Best", 12 ), 
		Set Values( [0.618584, 0.740841, 0.329065, 0.478055] ) ),
	New Column( "Drag", Numeric, "Continuous", Format( "Best", 12 ),
		Set Values( [0.117774, 0.417079, 0.218903, 0.214953] ) ),
	New Column( "uS", Numeric, "Continuous", Format( "Best", 12 ),
		Set Values( [0.417314, 0.417314, 0.365071, 0.365071] ) ),
	New Column( "psi", Numeric, "Continuous", Format( "Best", 12 ),
		Set Values( [21.15549, 21.15549, 25.65573, 25.65573] ) )
);

nr = nrows(dt);

dtt = New Table( "Split Tires");
dtt &amp;lt;&amp;lt; new column("Tire ID", Numeric, "Continuous", Format( "Best", 12 ));

split_cols = {"Depth", "Drag"};
nonsplit_cols = {"uS", "psi"};

for (i = 1, i &amp;lt;= nitems(split_cols), i++,
	inn_col = "Inner " || split_cols[i];
	out_col = "Outer " || split_cols[i];
	dtt &amp;lt;&amp;lt; new column(inn_col, Numeric, "Continuous", Format( "Best", 12 ));
	dtt &amp;lt;&amp;lt; new column(out_col, Numeric, "Continuous", Format( "Best", 12 ));
);

for (i = 1, i &amp;lt;= nitems(nonsplit_cols), i++,
	one_col = nonsplit_cols[i];
	dtt &amp;lt;&amp;lt; new column(one_col, Numeric, "Continuous", Format( "Best", 12 ));
);

dtt &amp;lt;&amp;lt; Add Rows( nr/2 );

k = 0;
for (i = 1, i &amp;lt;= nr, i+=2,
	k++;
	for (m = 1, m &amp;lt;= nitems(split_cols), m++,
		one_col = split_cols[m];
		inn_col = "Inner " || split_cols[m];
		out_col = "Outer " || split_cols[m];

		column(dtt, inn_col)[k] = column(dt, one_col)[i];
		column(dtt, out_col)[k] = column(dt, one_col)[i+1];
	);

	column(dtt, "Tire ID")[k] = column(dt, "Tire ID")[i];

	for (m = 1, m &amp;lt;= nitems(nonsplit_cols), m++,
		one_col = nonsplit_cols[m];
		column(dtt, one_col)[k] = column(dt, one_col)[i];
	);
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 02 Mar 2022 01:56:21 GMT</pubDate>
    <dc:creator>pmroz</dc:creator>
    <dc:date>2022-03-02T01:56:21Z</dc:date>
    <item>
      <title>Reorganizing A Table by Items Within A Column</title>
      <link>https://community.jmp.com/t5/Discussions/Reorganizing-A-Table-by-Items-Within-A-Column/m-p/466038#M70982</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a system that calibrates data and outputs the information as so:&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Tire ID&lt;/TD&gt;&lt;TD&gt;Tread&lt;/TD&gt;&lt;TD&gt;Depth&lt;/TD&gt;&lt;TD&gt;Drag&lt;/TD&gt;&lt;TD&gt;uS&lt;/TD&gt;&lt;TD&gt;psi&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2326&lt;/TD&gt;&lt;TD&gt;Inner&lt;/TD&gt;&lt;TD&gt;0.618584&lt;/TD&gt;&lt;TD&gt;0.117774&lt;/TD&gt;&lt;TD&gt;0.417314&lt;/TD&gt;&lt;TD&gt;21.15549&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2326&lt;/TD&gt;&lt;TD&gt;Outer&lt;/TD&gt;&lt;TD&gt;0.740841&lt;/TD&gt;&lt;TD&gt;0.417079&lt;/TD&gt;&lt;TD&gt;0.417314&lt;/TD&gt;&lt;TD&gt;21.15549&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2327&lt;/TD&gt;&lt;TD&gt;Inner&lt;/TD&gt;&lt;TD&gt;0.329065&lt;/TD&gt;&lt;TD&gt;0.218903&lt;/TD&gt;&lt;TD&gt;0.365071&lt;/TD&gt;&lt;TD&gt;25.65573&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2327&lt;/TD&gt;&lt;TD&gt;Outer&lt;/TD&gt;&lt;TD&gt;0.478055&lt;/TD&gt;&lt;TD&gt;0.214953&lt;/TD&gt;&lt;TD&gt;0.365071&lt;/TD&gt;&lt;TD&gt;25.65573&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Tire ID is read twice, once for the inner tread readings, and once for the outside. Is there a script I can use to reorganize it as such:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Tire ID&lt;/TD&gt;&lt;TD&gt;Inner Depth&lt;/TD&gt;&lt;TD&gt;Outer Depth&lt;/TD&gt;&lt;TD&gt;Inner Drag&lt;/TD&gt;&lt;TD&gt;Outer Drag&lt;/TD&gt;&lt;TD&gt;uS&lt;/TD&gt;&lt;TD&gt;psi&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2326&lt;/TD&gt;&lt;TD&gt;0.61858445&lt;/TD&gt;&lt;TD&gt;0.74084057&lt;/TD&gt;&lt;TD&gt;0.1177737&lt;/TD&gt;&lt;TD&gt;0.4170794&lt;/TD&gt;&lt;TD&gt;0.41731&lt;/TD&gt;&lt;TD&gt;21.1555&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2327&lt;/TD&gt;&lt;TD&gt;0.32906451&lt;/TD&gt;&lt;TD&gt;0.47805545&lt;/TD&gt;&lt;TD&gt;0.2189025&lt;/TD&gt;&lt;TD&gt;0.2149527&lt;/TD&gt;&lt;TD&gt;0.36507&lt;/TD&gt;&lt;TD&gt;25.6557&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here, there is only one entry per tire. The entries for Depth and Drag have been renamed by Inner or Outer and the identical columns have just been merged into one. This is a snip of a much larger sheet with many more columns - some different, others the same.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ideally, the script can determine what cells are the same according to tired ID and just remove replicates. But a script that's set up with predetermined names could work too, since the column names never change.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;,&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;&amp;nbsp;, you two helped tremendously last time! Thank you for that! I don't really know what approach to take and haven't been able to find anything similar enough in previous solutions.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 00:46:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Reorganizing-A-Table-by-Items-Within-A-Column/m-p/466038#M70982</guid>
      <dc:creator>Arocha1</dc:creator>
      <dc:date>2023-06-09T00:46:13Z</dc:date>
    </item>
    <item>
      <title>Re: Reorganizing A Table by Items Within A Column</title>
      <link>https://community.jmp.com/t5/Discussions/Reorganizing-A-Table-by-Items-Within-A-Column/m-p/466063#M70985</link>
      <description>&lt;P&gt;This is a brute-force approach, but it works.&amp;nbsp; Note the variables for split columns and nonsplit columns.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = New Table( "Base Tire Data", Add Rows( 4 ),
	New Column( "Tire ID", Numeric, "Continuous", Format( "Best", 12 ),
		Set Values( [2326, 2326, 2327, 2327] ) ),
	New Column( "Tread", Character( 16 ), "Nominal",
		Set Values( {"Inner", "Outer", "Inner", "Outer"} ) ),
	New Column( "Depth", Numeric, "Continuous", Format( "Best", 12 ), 
		Set Values( [0.618584, 0.740841, 0.329065, 0.478055] ) ),
	New Column( "Drag", Numeric, "Continuous", Format( "Best", 12 ),
		Set Values( [0.117774, 0.417079, 0.218903, 0.214953] ) ),
	New Column( "uS", Numeric, "Continuous", Format( "Best", 12 ),
		Set Values( [0.417314, 0.417314, 0.365071, 0.365071] ) ),
	New Column( "psi", Numeric, "Continuous", Format( "Best", 12 ),
		Set Values( [21.15549, 21.15549, 25.65573, 25.65573] ) )
);

nr = nrows(dt);

dtt = New Table( "Split Tires");
dtt &amp;lt;&amp;lt; new column("Tire ID", Numeric, "Continuous", Format( "Best", 12 ));

split_cols = {"Depth", "Drag"};
nonsplit_cols = {"uS", "psi"};

for (i = 1, i &amp;lt;= nitems(split_cols), i++,
	inn_col = "Inner " || split_cols[i];
	out_col = "Outer " || split_cols[i];
	dtt &amp;lt;&amp;lt; new column(inn_col, Numeric, "Continuous", Format( "Best", 12 ));
	dtt &amp;lt;&amp;lt; new column(out_col, Numeric, "Continuous", Format( "Best", 12 ));
);

for (i = 1, i &amp;lt;= nitems(nonsplit_cols), i++,
	one_col = nonsplit_cols[i];
	dtt &amp;lt;&amp;lt; new column(one_col, Numeric, "Continuous", Format( "Best", 12 ));
);

dtt &amp;lt;&amp;lt; Add Rows( nr/2 );

k = 0;
for (i = 1, i &amp;lt;= nr, i+=2,
	k++;
	for (m = 1, m &amp;lt;= nitems(split_cols), m++,
		one_col = split_cols[m];
		inn_col = "Inner " || split_cols[m];
		out_col = "Outer " || split_cols[m];

		column(dtt, inn_col)[k] = column(dt, one_col)[i];
		column(dtt, out_col)[k] = column(dt, one_col)[i+1];
	);

	column(dtt, "Tire ID")[k] = column(dt, "Tire ID")[i];

	for (m = 1, m &amp;lt;= nitems(nonsplit_cols), m++,
		one_col = nonsplit_cols[m];
		column(dtt, one_col)[k] = column(dt, one_col)[i];
	);
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 02 Mar 2022 01:56:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Reorganizing-A-Table-by-Items-Within-A-Column/m-p/466063#M70985</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2022-03-02T01:56:21Z</dc:date>
    </item>
    <item>
      <title>Re: Reorganizing A Table by Items Within A Column</title>
      <link>https://community.jmp.com/t5/Discussions/Reorganizing-A-Table-by-Items-Within-A-Column/m-p/466068#M70986</link>
      <description>&lt;P&gt;What you are asking for is available by using the Split platform&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Tables=&amp;gt;Split&lt;/P&gt;
&lt;P&gt;After you open the Split platform, setup the screen as shown below&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1646193416139.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/40422iE52E85497E55C2C0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="txnelson_0-1646193416139.png" alt="txnelson_0-1646193416139.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Once you click OK, it will create a new data table&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_1-1646193468096.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/40423iC5270D930A0C12BB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="txnelson_1-1646193468096.png" alt="txnelson_1-1646193468096.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;The script to perform the Split is contained in the Source entry of the data table&lt;/P&gt;
&lt;P&gt;Just right click on the word Source&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_2-1646193598384.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/40424i1B4F570DE6EF424C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="txnelson_2-1646193598384.png" alt="txnelson_2-1646193598384.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;and select Edit&lt;/P&gt;
&lt;P&gt;The Edit window will open and show the JSL required to run the Split and create the data table you want.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_3-1646193743909.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/40425i9FB35EA28E9CB6FA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="txnelson_3-1646193743909.png" alt="txnelson_3-1646193743909.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Just cut and paste the JSL from the Edit window, into your script&lt;/P&gt;</description>
      <pubDate>Wed, 02 Mar 2022 04:03:09 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Reorganizing-A-Table-by-Items-Within-A-Column/m-p/466068#M70986</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2022-03-02T04:03:09Z</dc:date>
    </item>
    <item>
      <title>Re: Reorganizing A Table by Items Within A Column</title>
      <link>https://community.jmp.com/t5/Discussions/Reorganizing-A-Table-by-Items-Within-A-Column/m-p/466154#M70995</link>
      <description>&lt;P&gt;Nice Jim!&amp;nbsp; Much better than my brute force approach.&amp;nbsp; I would add uS and psi to the Group columns as per&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/36890"&gt;@Arocha1&lt;/a&gt;&amp;nbsp;'s request.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="pmroz_0-1646221599613.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/40429i393A6AC463B48256/image-size/medium?v=v2&amp;amp;px=400" role="button" title="pmroz_0-1646221599613.png" alt="pmroz_0-1646221599613.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="pmroz_1-1646221658762.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/40430iED75AD5E0BF36CA7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="pmroz_1-1646221658762.png" alt="pmroz_1-1646221658762.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Mar 2022 11:47:48 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Reorganizing-A-Table-by-Items-Within-A-Column/m-p/466154#M70995</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2022-03-02T11:47:48Z</dc:date>
    </item>
  </channel>
</rss>

