<?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 with scripts for columns in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Need-help-with-scripts-for-columns/m-p/530171#M75336</link>
    <description>&lt;P&gt;Hey!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to automate the creation of some columns, which are always needed but the data that It'd take differs from table to table.&lt;/P&gt;&lt;P&gt;The format of each table would stay the same but the amount of data could differ so this script should work no matter the amount.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. I need to select all data of the column "Igtr_6V" where the TEMP is 25.&lt;/P&gt;&lt;P&gt;2. I need to copy said data, create a new column, paste it in there and fill the data to the end of table.&lt;/P&gt;&lt;P&gt;3. Create a new column where I need the Median of the previously selected values. This would result in 1 value and should be filled to the end of table aswell.&lt;/P&gt;&lt;P&gt;4. Create one last column which divides every "Igtr_6V" value with the value on the same row in the column that we created in step 2 using a formula.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As I said, this process should be automated via script and universally applicable as long as the format of the table stays the same.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will attach pictures of examples and the data table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Every bit of help is appreciated!&lt;/P&gt;</description>
    <pubDate>Sat, 10 Jun 2023 23:52:29 GMT</pubDate>
    <dc:creator>Lien</dc:creator>
    <dc:date>2023-06-10T23:52:29Z</dc:date>
    <item>
      <title>Need help with scripts for columns</title>
      <link>https://community.jmp.com/t5/Discussions/Need-help-with-scripts-for-columns/m-p/530171#M75336</link>
      <description>&lt;P&gt;Hey!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to automate the creation of some columns, which are always needed but the data that It'd take differs from table to table.&lt;/P&gt;&lt;P&gt;The format of each table would stay the same but the amount of data could differ so this script should work no matter the amount.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. I need to select all data of the column "Igtr_6V" where the TEMP is 25.&lt;/P&gt;&lt;P&gt;2. I need to copy said data, create a new column, paste it in there and fill the data to the end of table.&lt;/P&gt;&lt;P&gt;3. Create a new column where I need the Median of the previously selected values. This would result in 1 value and should be filled to the end of table aswell.&lt;/P&gt;&lt;P&gt;4. Create one last column which divides every "Igtr_6V" value with the value on the same row in the column that we created in step 2 using a formula.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As I said, this process should be automated via script and universally applicable as long as the format of the table stays the same.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will attach pictures of examples and the data table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Every bit of help is appreciated!&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:52:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Need-help-with-scripts-for-columns/m-p/530171#M75336</guid>
      <dc:creator>Lien</dc:creator>
      <dc:date>2023-06-10T23:52:29Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with scripts for columns</title>
      <link>https://community.jmp.com/t5/Discussions/Need-help-with-scripts-for-columns/m-p/530223#M75339</link>
      <description>&lt;P&gt;The purpose of the Community, is to solve issues that members are having with JMP, not as an organization who is there to writ scripts-on-demand.&amp;nbsp; Those requests have contract houses available for hire.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The proper beginning to solve your question is to read the JSL Scripting Guide in the JMP Documentation Library, available under the Help pull down menu.&lt;/P&gt;
&lt;P&gt;I have put together a script that I believe gets you where you want to go.&amp;nbsp; But you need to study it, so you understand what it does,&amp;nbsp; You will need the knowledge from the Scripting Guide to aid you in the interpretation.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Current Data Table();

// 1. I need to select all data of the column "Igtr_6V" where the TEMP is 25.
val25 = :Igtr_6V[dt &amp;lt;&amp;lt; get rows where( :temp == 25 )];

// 2. I need to copy said data, create a new column, paste it in there and fill the data to the end of table.
dt &amp;lt;&amp;lt; New Column( "IGT@25C",
	set each value(
		themod = Mod( Row(), Length( val25 ) );
		If( themod == 0,
			themod = Length( val25 )
		);
		val25[themod];
	)
);

// 3. Create a new column where I need the Median of the previously selected values
//    This would result in 1 value and should be filled to the end of table aswell.
dt &amp;lt;&amp;lt; New Column( "IGT@25C median", set each value( Median( val25 ) ) );

// 4. Create one last column which divides every "Igtr_6V" value with the value on
//    the same row in the column that we created in step 2 using a formula
dt &amp;lt;&amp;lt; New Column( "IGT(T)/IGT(25)", formula( :Igtr_6V / :"IGT@25C"n ) );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Aug 2022 10:48:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Need-help-with-scripts-for-columns/m-p/530223#M75339</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2022-08-04T10:48:24Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with scripts for columns</title>
      <link>https://community.jmp.com/t5/Discussions/Need-help-with-scripts-for-columns/m-p/530226#M75340</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I apologise for my frequent questions.&lt;/P&gt;&lt;P&gt;I am currently working as an intern at this company so I do not have the time to study the ins and outs of JMP.&lt;/P&gt;&lt;P&gt;Sadly nobody here really knows anything about scripting in JMP as I am probably the first one to concern myself with it since they just recently switched from Excel.&lt;/P&gt;&lt;P&gt;These are my last few days here and I would like to complete the task given to me before leaving. Over the last few weeks I have learned a lot about JMP and JSL and that is partly thanks to this community.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I genuinely appreciate your and everyone else's help!&amp;nbsp;&lt;/P&gt;&lt;P&gt;Again, sorry if I sound rude or unthankful! This will probably be my last post here anyways before I go back to school :)&lt;/img&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2022 11:12:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Need-help-with-scripts-for-columns/m-p/530226#M75340</guid>
      <dc:creator>Lien</dc:creator>
      <dc:date>2022-08-04T11:12:44Z</dc:date>
    </item>
  </channel>
</rss>

