<?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: JSL script to transpose columns  to rows in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/convert-columns-to-rows/m-p/362781#M61253</link>
    <description>&lt;P&gt;thanks&amp;nbsp; jim&lt;/P&gt;</description>
    <pubDate>Thu, 25 Feb 2021 18:28:05 GMT</pubDate>
    <dc:creator>steo45</dc:creator>
    <dc:date>2021-02-25T18:28:05Z</dc:date>
    <item>
      <title>convert  columns  to rows</title>
      <link>https://community.jmp.com/t5/Discussions/convert-columns-to-rows/m-p/344421#M59417</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data&amp;nbsp; and desired results&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;i would really appreciate your help&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:24:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/convert-columns-to-rows/m-p/344421#M59417</guid>
      <dc:creator>steo45</dc:creator>
      <dc:date>2023-06-10T23:24:17Z</dc:date>
    </item>
    <item>
      <title>Re: JSL script to transpose columns  to rows</title>
      <link>https://community.jmp.com/t5/Discussions/convert-columns-to-rows/m-p/344459#M59419</link>
      <description>&lt;P&gt;The script below is a good start on creating the output table you requested&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Current Data Table();

// Transpose the Demographics
dtTrans1 = dt &amp;lt;&amp;lt; Transpose(
	columns( :SBIN, :HBIN, :Alarms, :Device, :Site ),
	Transpose selected rows only( 1 ),
	Output Table( "Transpose 1" )
);

// Change the name of the first column
dtTrans1:Label &amp;lt;&amp;lt; set name( "Column 1" ) &amp;lt;&amp;lt; Set Display Width( 150 );

// Change the new column names
For( i = 2, i &amp;lt;= N Cols( dtTrans1 ), i++,
	Column( dtTrans1, i ) &amp;lt;&amp;lt; set name( "Column " || Char( i + 4 ) ) &amp;lt;&amp;lt; Set Display Width( 100 )
);

// Change the detail name of the Alarms
dtTrans1:Column 1[(dtTrans1 &amp;lt;&amp;lt; get rows where( dtTrans1:Column 1 == "Alarms" ))[1]] = "Pass/Fail/Alarm";

// Create the Devce values
deviceRow = (dtTrans1 &amp;lt;&amp;lt; get rows where( dtTrans1:Column 1 == "Device" ))[1];
For( i = 2, i &amp;lt;= N Cols( dtTrans1 ), i++,
	Column( dtTrans1, i )[deviceRow] = i - 1
);

// Now Find all of the columns that are parameters
parameterColNamesList = {};
For( i = 1, i &amp;lt;= N Cols( dt ), i++,
	If( Is Missing( Num( Word( 1, Column( dt, i ) &amp;lt;&amp;lt; get name, ":" ) ) ) == 0,
		Insert Into( parameterColNamesList, Column( dt, i ) &amp;lt;&amp;lt; get name )
	)
);

// Transpose the parameter columns
dtTrans2 = dt &amp;lt;&amp;lt; Transpose(
	columns( Eval( parameterColNamesList ) ),
	Transpose selected rows only( 0 ),
	Output Table( "Transpose 2" )
);

// Add in the new columns to be created
dtTrans2 &amp;lt;&amp;lt; Add Multiple Columns( "Column", 5, before first, Character );

// Add the values to the new columns
For( i = 1, i &amp;lt;= N Rows( dtTrans2 ), i++,
	dtTrans2:Column 1[i] = Word( 1, dtTrans2:Label[i], ":" );
	dtTrans2:Column 2[i] = Word( 2, dtTrans2:Label[i], ":" );
	specs = Column( dt, dtTrans2:Label[i] ) &amp;lt;&amp;lt; get property( "spec limits" );
	If( Is Missing( specs["LSL"] ) == 0,
		dtTrans2:Column 3[i] = specs["LSL"]
	);
	If( Is Missing( specs["USL"] ) == 0,
		dtTrans2:Column 4[i] = specs["USL"]
	);
	If( Column( dt, dtTrans2:Label[i] ) &amp;lt;&amp;lt; get property( "Units" ) != "",
		dtTrans2:Column 5[i] = Column( dt, dtTrans2:Label[i] ) &amp;lt;&amp;lt; get property( "Units" )
	);
);

// Get rid of the label column which is no longer needed
dtTrans2 &amp;lt;&amp;lt; delete columns( :Label );

// Change the names of the Trans2 table to match the names in the Trans1 table
For( i = 6, i &amp;lt;= N Cols( dtTrans2 ), i++,
	Column( dtTrans2, i ) &amp;lt;&amp;lt; set name( "Column " || Char( i ) )
);

// Combine the 2 Transformed data tables
dtFinal = dtTrans1 &amp;lt;&amp;lt; concatenate( dtTrans2 );

// Cleanup the no longer needed data tables
close( dtTrans1, nosave );
close( dtTrans2, nosave );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 27 Dec 2020 22:42:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/convert-columns-to-rows/m-p/344459#M59419</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-12-27T22:42:44Z</dc:date>
    </item>
    <item>
      <title>Re: JSL script to transpose columns  to rows</title>
      <link>https://community.jmp.com/t5/Discussions/convert-columns-to-rows/m-p/344828#M59484</link>
      <description>&lt;P&gt;Thank You! this seems to work just fine. But for&amp;nbsp;some reason&amp;nbsp; the test name Lo Limit and Hi limits columns are put last. any way we can rearranged them&amp;nbsp; and label them in the script ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jan 2021 23:47:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/convert-columns-to-rows/m-p/344828#M59484</guid>
      <dc:creator>steo45</dc:creator>
      <dc:date>2021-01-08T23:47:10Z</dc:date>
    </item>
    <item>
      <title>Re: JSL script to transpose columns  to rows</title>
      <link>https://community.jmp.com/t5/Discussions/convert-columns-to-rows/m-p/344854#M59491</link>
      <description>What version of JMP are you using?</description>
      <pubDate>Tue, 29 Dec 2020 18:47:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/convert-columns-to-rows/m-p/344854#M59491</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-12-29T18:47:44Z</dc:date>
    </item>
    <item>
      <title>Re: JSL script to transpose columns  to rows</title>
      <link>https://community.jmp.com/t5/Discussions/convert-columns-to-rows/m-p/346788#M59761</link>
      <description>&lt;P&gt;im using jmp 14&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jan 2021 23:18:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/convert-columns-to-rows/m-p/346788#M59761</guid>
      <dc:creator>steo45</dc:creator>
      <dc:date>2021-01-08T23:18:37Z</dc:date>
    </item>
    <item>
      <title>Re: JSL script to transpose columns  to rows</title>
      <link>https://community.jmp.com/t5/Discussions/convert-columns-to-rows/m-p/346832#M59763</link>
      <description>&lt;P&gt;Here is a corrected version of the script, that positions the spec columns, etc. at the correct location and also adds in the column labels&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Current Data Table();

// Transpose the Demographics
dtTrans1 = dt &amp;lt;&amp;lt; Transpose(
	columns( :SBIN, :HBIN, :Alarms, :Device, :Site ),
	Transpose selected rows only( 1 ),
	Output Table( "Transpose 1" )
);

// Change the name of the first column
dtTrans1:Label &amp;lt;&amp;lt; set name( "Column 1" ) &amp;lt;&amp;lt; Set Display Width( 150 );

// Change the new column names
For( i = 2, i &amp;lt;= N Cols( dtTrans1 ), i++,
	Column( dtTrans1, i ) &amp;lt;&amp;lt; set name( "Column " || Char( i + 4 ) ) &amp;lt;&amp;lt; Set Display Width( 100 )
);

// Change the detail name of the Alarms
dtTrans1:Column 1[(dtTrans1 &amp;lt;&amp;lt; get rows where( dtTrans1:Column 1 == "Alarms" ))[1]] = "Pass/Fail/Alarm";

// Create the Devce values
deviceRow = (dtTrans1 &amp;lt;&amp;lt; get rows where( dtTrans1:Column 1 == "Device" ))[1];
For( i = 2, i &amp;lt;= N Cols( dtTrans1 ), i++,
	Column( dtTrans1, i )[deviceRow] = i - 1
);


// Now Find all of the columns that are parameters
parameterColNamesList = {};
For( i = 1, i &amp;lt;= N Cols( dt ), i++,
	If( Is Missing( Num( Word( 1, Column( dt, i ) &amp;lt;&amp;lt; get name, ":" ) ) ) == 0,
		Insert Into( parameterColNamesList, Column( dt, i ) &amp;lt;&amp;lt; get name )
	)
);

// Transpose the parameter columns
dtTrans2 = dt &amp;lt;&amp;lt; Transpose(
	columns( Eval( parameterColNamesList ) ),
	Transpose selected rows only( 0 ),
	Output Table( "Transpose 2" )
);

// Add in the new columns to be created
dtTrans2 &amp;lt;&amp;lt; Add Multiple Columns( "Column", 5, before first, Character );

// Add the columns 2-5 in the trans data table
dtTrans1 &amp;lt;&amp;lt; Add Multiple Columns( "xColumn", 4,after(:Column 1), Character );
for(i=2,i&amp;lt;=5,i++,
	column(dtTrans1,i)&amp;lt;&amp;lt;set name("Column " || char(i));
);

// Add a row at the end of the table, and add the labels 
dtTrans1 &amp;lt;&amp;lt; add rows(1);
dtTrans1:Column 1[6] = "# Test Number";
dtTrans1:Column 2[6] = "Test Name";
dtTrans1:Column 3[6] = "Lo Limit";
dtTrans1:Column 4[6] = "Hi Limit";
dtTrans1:Column 5[6] = "Unit";

// Add the values to the new columns
For( i = 1, i &amp;lt;= N Rows( dtTrans2 ), i++,
	dtTrans2:Column 1[i] = Word( 1, dtTrans2:Label[i], ":" );
	dtTrans2:Column 2[i] = Word( 2, dtTrans2:Label[i], ":" );
	specs = Column( dt, dtTrans2:Label[i] ) &amp;lt;&amp;lt; get property( "spec limits" );
	If( Is Missing( specs["LSL"] ) == 0,
		dtTrans2:Column 3[i] = specs["LSL"]
	);
	If( Is Missing( specs["USL"] ) == 0,
		dtTrans2:Column 4[i] = specs["USL"]
	);
	If( Column( dt, dtTrans2:Label[i] ) &amp;lt;&amp;lt; get property( "Units" ) != "",
		dtTrans2:Column 5[i] = Column( dt, dtTrans2:Label[i] ) &amp;lt;&amp;lt; get property( "Units" )
	);
);

// Get rid of the label column which is no longer needed
dtTrans2 &amp;lt;&amp;lt; delete columns( :Label );

// Change the names of the Trans2 table to match the names in the Trans1 table
For( i = 6, i &amp;lt;= N Cols( dtTrans2 ), i++,
	Column( dtTrans2, i ) &amp;lt;&amp;lt; set name( "Column " || Char( i ) )
);

// Combine the 2 Transformed data tables
dtFinal = dtTrans1 &amp;lt;&amp;lt; concatenate( dtTrans2 );

// Cleanup the no longer needed data tables
close( dtTrans1, nosave );
close( dtTrans2, nosave );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 09 Jan 2021 03:39:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/convert-columns-to-rows/m-p/346832#M59763</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-01-09T03:39:01Z</dc:date>
    </item>
    <item>
      <title>Re: JSL script to transpose columns  to rows</title>
      <link>https://community.jmp.com/t5/Discussions/convert-columns-to-rows/m-p/346835#M59765</link>
      <description>&lt;P&gt;thanks Jim! the format is perfect. however it doesnt work on with other similar dataset&amp;nbsp; for some reason. any reason why?&lt;/P&gt;</description>
      <pubDate>Sat, 09 Jan 2021 16:59:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/convert-columns-to-rows/m-p/346835#M59765</guid>
      <dc:creator>steo45</dc:creator>
      <dc:date>2021-01-09T16:59:43Z</dc:date>
    </item>
    <item>
      <title>Re: JSL script to transpose columns  to rows</title>
      <link>https://community.jmp.com/t5/Discussions/convert-columns-to-rows/m-p/346836#M59766</link>
      <description>&lt;P&gt;Are there any error messages in the log?&lt;/P&gt;
&lt;P&gt;What are the differences between the 2 data tables?&lt;/P&gt;
&lt;P&gt;Is the script stopping before it's completion?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 09 Jan 2021 17:47:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/convert-columns-to-rows/m-p/346836#M59766</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-01-09T17:47:59Z</dc:date>
    </item>
    <item>
      <title>Re: JSL script to transpose columns  to rows</title>
      <link>https://community.jmp.com/t5/Discussions/convert-columns-to-rows/m-p/347428#M59821</link>
      <description>there is no log error. when i run the script, it just doesnt do anything. the only difference is the test names... they are different. but all others headers are the same</description>
      <pubDate>Mon, 11 Jan 2021 20:56:27 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/convert-columns-to-rows/m-p/347428#M59821</guid>
      <dc:creator>steo45</dc:creator>
      <dc:date>2021-01-11T20:56:27Z</dc:date>
    </item>
    <item>
      <title>Re: JSL script to transpose columns  to rows</title>
      <link>https://community.jmp.com/t5/Discussions/convert-columns-to-rows/m-p/347453#M59823</link>
      <description>&lt;P&gt;Try running the code for line 1 through line 26.&amp;nbsp; All you have to do, is to select(highlight) those rows in your script, and then click on the Run Icon.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Current Data Table();

// Transpose the Demographics
dtTrans1 = dt &amp;lt;&amp;lt; Transpose(
	columns( :SBIN, :HBIN, :Alarms, :Device, :Site ),
	Transpose selected rows only( 1 ),
	Output Table( "Transpose 1" )
);

// Change the name of the first column
dtTrans1:Label &amp;lt;&amp;lt; set name( "Column 1" ) &amp;lt;&amp;lt; Set Display Width( 150 );

// Change the new column names
For( i = 2, i &amp;lt;= N Cols( dtTrans1 ), i++,
	Column( dtTrans1, i ) &amp;lt;&amp;lt; set name( "Column " || Char( i + 4 ) ) &amp;lt;&amp;lt; Set Display Width( 100 )
);

// Change the detail name of the Alarms
dtTrans1:Column 1[(dtTrans1 &amp;lt;&amp;lt; get rows where( dtTrans1:Column 1 == "Alarms" ))[1]] = "Pass/Fail/Alarm";

// Create the Devce values
deviceRow = (dtTrans1 &amp;lt;&amp;lt; get rows where( dtTrans1:Column 1 == "Device" ))[1];
For( i = 2, i &amp;lt;= N Cols( dtTrans1 ), i++,
	Column( dtTrans1, i )[deviceRow] = i - 1
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;See if the Transpose 1 data table looks like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="trans1.PNG" style="width: 488px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/29360iB51709348284C7B9/image-size/large?v=v2&amp;amp;px=999" role="button" title="trans1.PNG" alt="trans1.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;The run the lines 30 - 35&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;parameterColNamesList = {};
For( i = 1, i &amp;lt;= N Cols( dt ), i++,
	If( Is Missing( Num( Word( 1, Column( dt, i ) &amp;lt;&amp;lt; get name, ":" ) ) ) == 0,
		Insert Into( parameterColNamesList, Column( dt, i ) &amp;lt;&amp;lt; get name )
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and see if the parameterColNamesList contains the names of all of the tests in the data table.&lt;/P&gt;
&lt;P&gt;Then keep checking the different sections of code, until you find what is not running correctly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you can provide to me a copy of the data table you are trying to read in, I would be willing to do the checking myself.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2021 21:20:40 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/convert-columns-to-rows/m-p/347453#M59823</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-01-11T21:20:40Z</dc:date>
    </item>
    <item>
      <title>Re: JSL script to transpose columns  to rows</title>
      <link>https://community.jmp.com/t5/Discussions/convert-columns-to-rows/m-p/348305#M59932</link>
      <description>&lt;P&gt;ok sure here it is&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jan 2021 22:39:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/convert-columns-to-rows/m-p/348305#M59932</guid>
      <dc:creator>steo45</dc:creator>
      <dc:date>2021-01-13T22:39:58Z</dc:date>
    </item>
    <item>
      <title>Re: JSL script to transpose columns  to rows</title>
      <link>https://community.jmp.com/t5/Discussions/convert-columns-to-rows/m-p/348306#M59933</link>
      <description>&lt;P&gt;here is a random sample data&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2021 20:53:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/convert-columns-to-rows/m-p/348306#M59933</guid>
      <dc:creator>steo45</dc:creator>
      <dc:date>2021-01-14T20:53:15Z</dc:date>
    </item>
    <item>
      <title>Re: JSL script to transpose columns  to rows</title>
      <link>https://community.jmp.com/t5/Discussions/convert-columns-to-rows/m-p/348436#M59936</link>
      <description>&lt;P&gt;&amp;nbsp;disregard the previous sample, please use this one&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2021 20:52:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/convert-columns-to-rows/m-p/348436#M59936</guid>
      <dc:creator>steo45</dc:creator>
      <dc:date>2021-01-14T20:52:58Z</dc:date>
    </item>
    <item>
      <title>Re: JSL script to transpose columns  to rows</title>
      <link>https://community.jmp.com/t5/Discussions/convert-columns-to-rows/m-p/348442#M59937</link>
      <description>&lt;P&gt;I ran the script against the subset sample data you provided, and it ran without error and produced an transposed data table.&amp;nbsp; I did find one small issue, which was the Test Names did not contain the complete name from the input data table.&amp;nbsp; But other than that, it seems to have run correctly.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="transfile.PNG" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/29422i8480FFE0FE606279/image-size/large?v=v2&amp;amp;px=999" role="button" title="transfile.PNG" alt="transfile.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Here is the corrected JSL&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Current Data Table();

// Transpose the Demographics
dtTrans1 = dt &amp;lt;&amp;lt; Transpose(
	columns( :SBIN, :HBIN, :Alarms, :Device, :Site ),
	Transpose selected rows only( 1 ),
	Output Table( "Transpose 1" )
);

// Change the name of the first column
dtTrans1:Label &amp;lt;&amp;lt; set name( "Column 1" ) &amp;lt;&amp;lt; Set Display Width( 150 );

// Change the new column names
For( i = 2, i &amp;lt;= N Cols( dtTrans1 ), i++,
	Column( dtTrans1, i ) &amp;lt;&amp;lt; set name( "Column " || Char( i + 4 ) ) &amp;lt;&amp;lt; Set Display Width( 100 )
);

// Change the detail name of the Alarms
dtTrans1:Column 1[(dtTrans1 &amp;lt;&amp;lt; get rows where( dtTrans1:Column 1 == "Alarms" ))[1]] = "Pass/Fail/Alarm";

// Create the Devce values
deviceRow = (dtTrans1 &amp;lt;&amp;lt; get rows where( dtTrans1:Column 1 == "Device" ))[1];
For( i = 2, i &amp;lt;= N Cols( dtTrans1 ), i++,
	Column( dtTrans1, i )[deviceRow] = i - 1
);


// Now Find all of the columns that are parameters
parameterColNamesList = {};
For( i = 1, i &amp;lt;= N Cols( dt ), i++,
	If( Is Missing( Num( Word( 1, Column( dt, i ) &amp;lt;&amp;lt; get name, ":" ) ) ) == 0,
		Insert Into( parameterColNamesList, Column( dt, i ) &amp;lt;&amp;lt; get name )
	)
);

// Transpose the parameter columns
dtTrans2 = dt &amp;lt;&amp;lt; Transpose(
	columns( Eval( parameterColNamesList ) ),
	Transpose selected rows only( 0 ),
	Output Table( "Transpose 2" )
);

// Add in the new columns to be created
dtTrans2 &amp;lt;&amp;lt; Add Multiple Columns( "Column", 5, before first, Character );

// Add the columns 2-5 in the trans data table
dtTrans1 &amp;lt;&amp;lt; Add Multiple Columns( "xColumn", 4,after(:Column 1), Character );
for(i=2,i&amp;lt;=5,i++,
	column(dtTrans1,i)&amp;lt;&amp;lt;set name("Column " || char(i));
);

// Add a row at the end of the table, and add the labels 
dtTrans1 &amp;lt;&amp;lt; add rows(1);
dtTrans1:Column 1[6] = "# Test Number";
dtTrans1:Column 2[6] = "Test Name";
dtTrans1:Column 3[6] = "Lo Limit";
dtTrans1:Column 4[6] = "Hi Limit";
dtTrans1:Column 5[6] = "Unit";

// Add the values to the new columns
For( i = 1, i &amp;lt;= N Rows( dtTrans2 ), i++,
	dtTrans2:Column 1[i] = Word( 1, dtTrans2:Label[i], ":" );
	dtTrans2:Column 2[i] = Substr( dtTrans2:Label[i], length( dtTrans2:Column 1[i] ) +3 );
	specs = Column( dt, dtTrans2:Label[i] ) &amp;lt;&amp;lt; get property( "spec limits" );
	If( Is Missing( specs["LSL"] ) == 0,
		dtTrans2:Column 3[i] = specs["LSL"]
	);
	If( Is Missing( specs["USL"] ) == 0,
		dtTrans2:Column 4[i] = specs["USL"]
	);
	If( Column( dt, dtTrans2:Label[i] ) &amp;lt;&amp;lt; get property( "Units" ) != "",
		dtTrans2:Column 5[i] = Column( dt, dtTrans2:Label[i] ) &amp;lt;&amp;lt; get property( "Units" )
	);
);

// Get rid of the label column which is no longer needed
dtTrans2 &amp;lt;&amp;lt; delete columns( :Label );

// Change the names of the Trans2 table to match the names in the Trans1 table
For( i = 6, i &amp;lt;= N Cols( dtTrans2 ), i++,
	Column( dtTrans2, i ) &amp;lt;&amp;lt; set name( "Column " || Char( i ) )
);

// Combine the 2 Transformed data tables
dtFinal = dtTrans1 &amp;lt;&amp;lt; concatenate( dtTrans2 );

// Cleanup the no longer needed data tables
close( dtTrans1, nosave );
close( dtTrans2, nosave );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 14 Jan 2021 02:11:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/convert-columns-to-rows/m-p/348442#M59937</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-01-14T02:11:42Z</dc:date>
    </item>
    <item>
      <title>Re: JSL script to transpose columns  to rows</title>
      <link>https://community.jmp.com/t5/Discussions/convert-columns-to-rows/m-p/348445#M59938</link>
      <description>&lt;P&gt;This sample data table has an issue with the Device column.&amp;nbsp; It is set as a Character Data Type.&amp;nbsp; If you change it to Numeric, the script works fine.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2021 02:23:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/convert-columns-to-rows/m-p/348445#M59938</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-01-14T02:23:13Z</dc:date>
    </item>
    <item>
      <title>Re: JSL script to transpose columns  to rows</title>
      <link>https://community.jmp.com/t5/Discussions/convert-columns-to-rows/m-p/348749#M59976</link>
      <description>&lt;P&gt;thanks jim&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2021 20:53:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/convert-columns-to-rows/m-p/348749#M59976</guid>
      <dc:creator>steo45</dc:creator>
      <dc:date>2021-01-14T20:53:57Z</dc:date>
    </item>
    <item>
      <title>Re: JSL script to transpose columns  to rows</title>
      <link>https://community.jmp.com/t5/Discussions/convert-columns-to-rows/m-p/362304#M61205</link>
      <description>&lt;P&gt;hello jim&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;i still find issue with other data table for some reasons i checked the data type and make sure they are all the same. but its not working&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="steo45_0-1614186861096.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/30665i7792D9EB1138AB39/image-size/medium?v=v2&amp;amp;px=400" role="button" title="steo45_0-1614186861096.png" alt="steo45_0-1614186861096.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2021 17:14:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/convert-columns-to-rows/m-p/362304#M61205</guid>
      <dc:creator>steo45</dc:creator>
      <dc:date>2021-02-24T17:14:45Z</dc:date>
    </item>
    <item>
      <title>Re: JSL script to transpose columns  to rows</title>
      <link>https://community.jmp.com/t5/Discussions/convert-columns-to-rows/m-p/362356#M61213</link>
      <description>&lt;P&gt;The error message that is displayed indicates that the data table that "dtTrans2" points to is not being created.&amp;nbsp; "dtTrans2" is created from a Transpose(), which requires a list of parameters from your original data table.&amp;nbsp; The "parameterColNamesList" is created by finding all columns in your original data table that starts with a number followed by a ":".&amp;nbsp; I suspect your parameters are not named like that in your original data table.&amp;nbsp; But without seeing the data table, I am only guessing.&amp;nbsp; If what I am guessing is true, then something needs to be found that identifies the parameter columns.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2021 18:11:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/convert-columns-to-rows/m-p/362356#M61213</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-02-24T18:11:18Z</dc:date>
    </item>
    <item>
      <title>Re: JSL script to transpose columns  to rows</title>
      <link>https://community.jmp.com/t5/Discussions/convert-columns-to-rows/m-p/362376#M61214</link>
      <description>&lt;P&gt;here is one&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2021 19:06:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/convert-columns-to-rows/m-p/362376#M61214</guid>
      <dc:creator>steo45</dc:creator>
      <dc:date>2021-02-24T19:06:29Z</dc:date>
    </item>
    <item>
      <title>Re: JSL script to transpose columns  to rows</title>
      <link>https://community.jmp.com/t5/Discussions/convert-columns-to-rows/m-p/362396#M61218</link>
      <description>&lt;P&gt;The issue was that one or more of the Parameters were input as character data.&amp;nbsp; The Transpose can not handle mixed data.&amp;nbsp; So I have added a check to make sure that all detected parameters are numeric.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Current Data Table();

// Transpose the Demographics
dtTrans1 = dt &amp;lt;&amp;lt; Transpose(
	columns( :SBIN, :HBIN, :Alarms, :Device, :Site ),
	Transpose selected rows only( 1 ),
	Output Table( "Transpose 1" )
);

// Change the name of the first column
dtTrans1:Label &amp;lt;&amp;lt; set name( "Column 1" ) &amp;lt;&amp;lt; Set Display Width( 150 );

// Change the new column names
For( i = 2, i &amp;lt;= N Cols( dtTrans1 ), i++,
	Column( dtTrans1, i ) &amp;lt;&amp;lt; set name( "Column " || Char( i + 4 ) ) &amp;lt;&amp;lt; Set Display Width( 100 )
);

// Change the detail name of the Alarms
dtTrans1:Column 1[(dtTrans1 &amp;lt;&amp;lt; get rows where( dtTrans1:Column 1 == "Alarms" ))[1]] = "Pass/Fail/Alarm";

// Create the Devce values
deviceRow = (dtTrans1 &amp;lt;&amp;lt; get rows where( dtTrans1:Column 1 == "Device" ))[1];
For( i = 2, i &amp;lt;= N Cols( dtTrans1 ), i++,
	Column( dtTrans1, i )[deviceRow] = i - 1
);


// Now Find all of the columns that are parameters
parameterColNamesList = {};
For( i = 1, i &amp;lt;= N Cols( dt ), i++,
	If( Is Missing( Num( Word( 1, Column( dt, i ) &amp;lt;&amp;lt; get name, ":" ) ) ) == 0 &amp;amp;
		Column( dt, i ) &amp;lt;&amp;lt; get modeling type == "Continuous",
		Insert Into( parameterColNamesList, Column( dt, i ) &amp;lt;&amp;lt; get name )
	)
);

// Transpose the parameter columns
dtTrans2 = dt &amp;lt;&amp;lt; Transpose(
	columns( Eval( parameterColNamesList ) ),
	Transpose selected rows only( 0 ),
	Output Table( "Transpose 2" )
);

// Add in the new columns to be created
dtTrans2 &amp;lt;&amp;lt; Add Multiple Columns( "Column", 5, before first, Character );

// Add the columns 2-5 in the trans data table
dtTrans1 &amp;lt;&amp;lt; Add Multiple Columns( "xColumn", 4,after(:Column 1), Character );
for(i=2,i&amp;lt;=5,i++,
	column(dtTrans1,i)&amp;lt;&amp;lt;set name("Column " || char(i));
);

// Add a row at the end of the table, and add the labels 
dtTrans1 &amp;lt;&amp;lt; add rows(1);
dtTrans1:Column 1[6] = "# Test Number";
dtTrans1:Column 2[6] = "Test Name";
dtTrans1:Column 3[6] = "Lo Limit";
dtTrans1:Column 4[6] = "Hi Limit";
dtTrans1:Column 5[6] = "Unit";

// Add the values to the new columns
For( i = 1, i &amp;lt;= N Rows( dtTrans2 ), i++,
	dtTrans2:Column 1[i] = Word( 1, dtTrans2:Label[i], ":" );
	dtTrans2:Column 2[i] = Substr( dtTrans2:Label[i], length( dtTrans2:Column 1[i] ) +3 );
	specs = Column( dt, dtTrans2:Label[i] ) &amp;lt;&amp;lt; get property( "spec limits" );
	If( Is Missing( specs["LSL"] ) == 0,
		dtTrans2:Column 3[i] = char(specs["LSL"])
	);
	If( Is Missing( specs["USL"] ) == 0,
		dtTrans2:Column 4[i] = char(specs["USL"])
	);
	If( Column( dt, dtTrans2:Label[i] ) &amp;lt;&amp;lt; get property( "Units" ) != "",
		dtTrans2:Column 5[i] = Column( dt, dtTrans2:Label[i] ) &amp;lt;&amp;lt; get property( "Units" )
	);
);

// Get rid of the label column which is no longer needed
dtTrans2 &amp;lt;&amp;lt; delete columns( :Label );

// Change the names of the Trans2 table to match the names in the Trans1 table
For( i = 6, i &amp;lt;= N Cols( dtTrans2 ), i++,
	Column( dtTrans2, i ) &amp;lt;&amp;lt; set name( "Column " || Char( i ) )
);

// Combine the 2 Transformed data tables
dtFinal = dtTrans1 &amp;lt;&amp;lt; concatenate( dtTrans2 );

// Cleanup the no longer needed data tables
close( dtTrans1, nosave );
close( dtTrans2, nosave );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 25 Feb 2021 03:08:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/convert-columns-to-rows/m-p/362396#M61218</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-02-25T03:08:42Z</dc:date>
    </item>
  </channel>
</rss>

