<?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 if statement then Delete Column in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/JSL-script-if-statement-then-Delete-Column/m-p/79863#M36820</link>
    <description>&lt;P&gt;If I am interpreting your request properly, the following simple script will give you what you want&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Current Data Table();

// Initialize a counter
count = 0;

// Loop through the last 10 rows and count
// the number of times :A&amp;lt;=:B
For( i = N Rows( dt ) - 9, i &amp;lt;= N Rows( dt ),
	i++,
	If( :A[i] &amp;lt;= :B[i], count++ )
);

// Handle the 2 scenarios for which columns to delete
If( count == 10,
	dt &amp;lt;&amp;lt; delete columns( {"C", "E"} ),
	dt &amp;lt;&amp;lt; delete columns( {"D", "F"} )
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 22 Oct 2018 03:59:41 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2018-10-22T03:59:41Z</dc:date>
    <item>
      <title>JSL script if statement then Delete Column</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-script-if-statement-then-Delete-Column/m-p/79854#M36819</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am new to JSL script. How do I write in JSL script for the scenario below:&lt;/P&gt;&lt;P&gt;If&amp;nbsp; last 10 rows in column A &amp;lt;= to last 10 rows in column B, then delete column C and column E else delete column D and column F. The values in the last 10 rows within columns A &amp;amp; B are always the same. Can anyone help to translate this into JSL script?&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="Pic1.JPG" style="width: 584px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/12942i1C0DB3290152F362/image-size/large?v=v2&amp;amp;px=999" role="button" title="Pic1.JPG" alt="Pic1.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Oct 2018 02:51:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-script-if-statement-then-Delete-Column/m-p/79854#M36819</guid>
      <dc:creator>ReginaHong</dc:creator>
      <dc:date>2018-10-22T02:51:42Z</dc:date>
    </item>
    <item>
      <title>Re: JSL script if statement then Delete Column</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-script-if-statement-then-Delete-Column/m-p/79863#M36820</link>
      <description>&lt;P&gt;If I am interpreting your request properly, the following simple script will give you what you want&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Current Data Table();

// Initialize a counter
count = 0;

// Loop through the last 10 rows and count
// the number of times :A&amp;lt;=:B
For( i = N Rows( dt ) - 9, i &amp;lt;= N Rows( dt ),
	i++,
	If( :A[i] &amp;lt;= :B[i], count++ )
);

// Handle the 2 scenarios for which columns to delete
If( count == 10,
	dt &amp;lt;&amp;lt; delete columns( {"C", "E"} ),
	dt &amp;lt;&amp;lt; delete columns( {"D", "F"} )
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 22 Oct 2018 03:59:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-script-if-statement-then-Delete-Column/m-p/79863#M36820</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2018-10-22T03:59:41Z</dc:date>
    </item>
  </channel>
</rss>

