<?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: Create a New Column and Add Notes in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Create-a-New-Column-and-Add-Notes/m-p/772535#M95295</link>
    <description>&lt;P&gt;Jarmo&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Went with the second one, works spot on!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Slán&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SpannerHead&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 11 Jul 2024 15:18:53 GMT</pubDate>
    <dc:creator>SpannerHead</dc:creator>
    <dc:date>2024-07-11T15:18:53Z</dc:date>
    <item>
      <title>Create a New Column and Add Notes</title>
      <link>https://community.jmp.com/t5/Discussions/Create-a-New-Column-and-Add-Notes/m-p/772510#M95292</link>
      <description>&lt;P&gt;I find the Notes property in a JMP column useful as a means to automatically add labels to the resulting graphs.&amp;nbsp; The issue I'm having relates to generating new data columns related to parent columns and having the parent Notes automatically apply across.&amp;nbsp; In the script below, I had hoped that the line&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;&amp;lt;&amp;lt; set property( "Notes", Notes );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;would do the trick but I'm missing something.&amp;nbsp; Here's the main script.&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 );
dt = Current Data Table();
colList = dt &amp;lt;&amp;lt; get column names( numeric, string );
foundCols = "";
For( i = 1, i &amp;lt;= N Col( dt ), i++,
	Spud = ":" || colList[i];
	Spuds = Parse( Eval Insert( Spud ) );
	Show(Spuds);
	spec = Column( dt, colList[i] ) &amp;lt;&amp;lt; get property( "Spec Limits" );
	Notes = Column( dt, colList[i] ) &amp;lt;&amp;lt; get property( "Notes" );
	Show(Notes);
	dt &amp;lt;&amp;lt; clear select;
	If( Is Empty( spec ) == 0,
		dt &amp;lt;&amp;lt; New Column(
			(Column( dt, colList[i] ) &amp;lt;&amp;lt; get name) || " % Delta From Target",
			Formula(
				If( Spuds &amp;gt; (Spuds &amp;lt;&amp;lt; get property( "Spec Limits" ))["Target"],
					Num(
						(Spuds - (Spuds &amp;lt;&amp;lt; get property( "Spec Limits" ))["Target"])
						 / ((Spuds &amp;lt;&amp;lt; get property( "Spec Limits" ))["USL"] - (Spuds
						 &amp;lt;&amp;lt; get property( "Spec Limits" ))["Target"])
					) * 100,
					If( Spuds &amp;lt; (Spuds &amp;lt;&amp;lt; get property( "Spec Limits" ))["Target"],
						Num(
							((Spuds &amp;lt;&amp;lt; get property( "Spec Limits" ))["Target"]
							-Spuds) / ((Spuds &amp;lt;&amp;lt; get property( "Spec Limits" ))[
							"LSL"] - (Spuds &amp;lt;&amp;lt; get property( "Spec Limits" ))[
							"Target"]) * 100
						),
						0
					)
				)
			)
		) &amp;lt;&amp;lt; set property( "Notes", Notes );
		If( Is Missing( Try( spec["LSL"], . ) ) == 0,
			dt &amp;lt;&amp;lt; select where( As Column( dt, colList[i] ) + spec["LSL"] );
			Try( Column( dt, N Cols( dt ) )[dt &amp;lt;&amp;lt; get selected rows] = 0 );
		);
		If( Is Missing( Try( spec["USL"], . ) ) == 0,
			dt &amp;lt;&amp;lt; select where(
				As Column( dt, colList[i] ) - spec["USL"],
				current selection( "extend" )
			);
			Try( Column( dt, N Cols( dt ) )[dt &amp;lt;&amp;lt; get selected rows] = 0 );
		);
		dt &amp;lt;&amp;lt; select where(
			Is Missing( As Column( dt, colList[i] ) ),
			current selection( "extend" )
		);
		dt &amp;lt;&amp;lt; invert row selection;
		Try( Column( dt, N Cols( dt ) )[dt &amp;lt;&amp;lt; get selected rows] = 1 );
		Column( dt, N Cols( dt ) );
		If( foundCols == "",
			foundCols = ":Name(\!"" || (Column( dt, colList[i] ) &amp;lt;&amp;lt; get name) ||
			" % Delta From Target\!")",
			foundCols = foundCols || ", " || ":Name(\!"" || (
			Column( dt, colList[i] ) &amp;lt;&amp;lt; get name) || " % Delta From Target\!")"
		);
	);
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Any help appreciated&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Slán&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SpannerHead&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2024 14:39:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Create-a-New-Column-and-Add-Notes/m-p/772510#M95292</guid>
      <dc:creator>SpannerHead</dc:creator>
      <dc:date>2024-07-11T14:39:30Z</dc:date>
    </item>
    <item>
      <title>Re: Create a New Column and Add Notes</title>
      <link>https://community.jmp.com/t5/Discussions/Create-a-New-Column-and-Add-Notes/m-p/772520#M95293</link>
      <description>&lt;P&gt;Either separate the note setting to happen after new column&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1); 

dt = open("$SAMPLE_DATA/Big Class.jmp");

For Each({colname}, dt &amp;lt;&amp;lt; Get Column Names("String"),
	curnote = Column(dt, colname) &amp;lt;&amp;lt; Get Property("Notes");
	new_col = dt &amp;lt;&amp;lt; New Column("A", Character, Nominal);
	new_col &amp;lt;&amp;lt; Set Property("Notes", curnote);
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or move it inside new column&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1); 

dt = open("$SAMPLE_DATA/Big Class.jmp");

For Each({colname}, dt &amp;lt;&amp;lt; Get Column Names("String"),
	curnote = Column(dt, colname) &amp;lt;&amp;lt; Get Property("Notes");
	new_col = dt &amp;lt;&amp;lt; New Column("A", Character, Nominal, Set Property("Notes", curnote));
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can get idea for the script by selecting a column with a note property, click the header with right click and select Copy Copy Columns or you can create new column and adding the property immediately and get the script from enhanced log&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Data Table("Big Class") &amp;lt;&amp;lt; New Column("Column 6",
	Numeric,
	"Continuous",
	Format("Best", 12),
	Set Property("Notes", "asdasd")
);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Jul 2024 14:52:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Create-a-New-Column-and-Add-Notes/m-p/772520#M95293</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-07-11T14:52:11Z</dc:date>
    </item>
    <item>
      <title>Re: Create a New Column and Add Notes</title>
      <link>https://community.jmp.com/t5/Discussions/Create-a-New-Column-and-Add-Notes/m-p/772535#M95295</link>
      <description>&lt;P&gt;Jarmo&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Went with the second one, works spot on!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Slán&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SpannerHead&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2024 15:18:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Create-a-New-Column-and-Add-Notes/m-p/772535#M95295</guid>
      <dc:creator>SpannerHead</dc:creator>
      <dc:date>2024-07-11T15:18:53Z</dc:date>
    </item>
  </channel>
</rss>

