<?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: Deleting column/table variable that is referenced in formula using JSL in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Deleting-column-table-variable-that-is-referenced-in-formula/m-p/559127#M77242</link>
    <description>&lt;P&gt;I think there isn't any flag that can do this. Maybe a place for wish list item, I think the flag should be similarly configurable as the interactive version which asks to remove refs, formula or cancel (I would maybe add Throw also).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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 = Open("$SAMPLE_DATA/Big Class.jmp");

dt &amp;lt;&amp;lt; New Column("f", Numeric, Continuous, Formula(:height*weight));
dt &amp;lt;&amp;lt; Delete Columns({"height", "weight"});&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Will print to log:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Cannot delete the selected columns while some are referenced by the formulas of remaining columns.&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Removing a formula leaves the data unchanged. Removing references replaces each reference with an empty value. These effects are permanent and cannot be undone.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Scriptable[]&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could capture this message with Log Capture() and then perform some JSL tricks to remove references / formulas beforehand.&lt;/P&gt;</description>
    <pubDate>Fri, 21 Oct 2022 15:42:39 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2022-10-21T15:42:39Z</dc:date>
    <item>
      <title>Deleting column/table variable that is referenced in formula using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Deleting-column-table-variable-that-is-referenced-in-formula/m-p/558925#M77215</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;As stated in the topic of this post, I observed that JSL commands "Delete Column" or "Delete Table Variable" don't work when either column has a function or table variable is a part of a function.&lt;/P&gt;&lt;P&gt;When performing this action "by hand" there is an extra warning window, that informs user about consequences of such action and allows to choose an action.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I understand that this behaviour was introduced intentionally, and I am totally fine with that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to ask if there is any option/argument/flag/command to bypass this window when deleting column/table variable using JSL?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for help.&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:55:40 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Deleting-column-table-variable-that-is-referenced-in-formula/m-p/558925#M77215</guid>
      <dc:creator>Ceg1</dc:creator>
      <dc:date>2023-06-10T23:55:40Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting column/table variable that is referenced in formula using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Deleting-column-table-variable-that-is-referenced-in-formula/m-p/559028#M77230</link>
      <description>&lt;P&gt;I am not able to replicate what I understand as the issue you are asking about. The below scripts are deleting a table variable and a column from within a formula and a function within each formula.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );

dt &amp;lt;&amp;lt; New Table Variable( "Days", 42 );
Wait( 5 );
dt &amp;lt;&amp;lt; New Column( "test",
	formula(
		delTVar = Function( {theVar},
			dt &amp;lt;&amp;lt; Delete Table Variable( theVar )
		);
		rc = delTVar( "Days" );
		:weight;
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );

Wait( 5 );
dt &amp;lt;&amp;lt; New Column( "test",
	formula(
		delCol = Function( {theCol},
			dt &amp;lt;&amp;lt; delete columns( theCol )
		);
		rc = delCol( "height" );
		:weight;
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 21 Oct 2022 14:21:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Deleting-column-table-variable-that-is-referenced-in-formula/m-p/559028#M77230</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2022-10-21T14:21:23Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting column/table variable that is referenced in formula using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Deleting-column-table-variable-that-is-referenced-in-formula/m-p/559127#M77242</link>
      <description>&lt;P&gt;I think there isn't any flag that can do this. Maybe a place for wish list item, I think the flag should be similarly configurable as the interactive version which asks to remove refs, formula or cancel (I would maybe add Throw also).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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 = Open("$SAMPLE_DATA/Big Class.jmp");

dt &amp;lt;&amp;lt; New Column("f", Numeric, Continuous, Formula(:height*weight));
dt &amp;lt;&amp;lt; Delete Columns({"height", "weight"});&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Will print to log:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Cannot delete the selected columns while some are referenced by the formulas of remaining columns.&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Removing a formula leaves the data unchanged. Removing references replaces each reference with an empty value. These effects are permanent and cannot be undone.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Scriptable[]&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could capture this message with Log Capture() and then perform some JSL tricks to remove references / formulas beforehand.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2022 15:42:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Deleting-column-table-variable-that-is-referenced-in-formula/m-p/559127#M77242</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2022-10-21T15:42:39Z</dc:date>
    </item>
  </channel>
</rss>

