<?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: Count in a script in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Count-in-a-script/m-p/236640#M46697</link>
    <description>Hi,&lt;BR /&gt;Sorry about not being clear. Is there a way to add the count into a script?&lt;BR /&gt;</description>
    <pubDate>Wed, 27 Nov 2019 01:28:27 GMT</pubDate>
    <dc:creator>Dennis1</dc:creator>
    <dc:date>2019-11-27T01:28:27Z</dc:date>
    <item>
      <title>Count in a script</title>
      <link>https://community.jmp.com/t5/Discussions/Count-in-a-script/m-p/236617#M46693</link>
      <description>Hi,&lt;BR /&gt;I need some assistance with adding a count in a script to a new column where it counts the number of rows from n=1 to n= m (based on size of size of text file). Any thoughts / comments greatly appreciated.&lt;BR /&gt;Cheers,&lt;BR /&gt;Dennis</description>
      <pubDate>Tue, 26 Nov 2019 23:30:19 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Count-in-a-script/m-p/236617#M46693</guid>
      <dc:creator>Dennis1</dc:creator>
      <dc:date>2019-11-26T23:30:19Z</dc:date>
    </item>
    <item>
      <title>Re: Count in a script</title>
      <link>https://community.jmp.com/t5/Discussions/Count-in-a-script/m-p/236638#M46695</link>
      <description>&lt;P&gt;I am not sure if I really understand what you want, but if it is a simple sequence number you can easily do that multiple ways.&lt;/P&gt;
&lt;P&gt;First, interactively.&amp;nbsp; Once you create the new column, simply go to the Col Info for the new column and click on the Missing/Empty down arrow and select "Sequence Data".&amp;nbsp; I will place into the new column a number from 1 to n.&lt;/P&gt;
&lt;P&gt;Second, you can use a formula in a new column.&amp;nbsp; Just create the new column, anduse the below formula to generate a sequence number for each row.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Row()&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Nov 2019 01:16:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Count-in-a-script/m-p/236638#M46695</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2019-11-27T01:16:59Z</dc:date>
    </item>
    <item>
      <title>Re: Count in a script</title>
      <link>https://community.jmp.com/t5/Discussions/Count-in-a-script/m-p/236640#M46697</link>
      <description>Hi,&lt;BR /&gt;Sorry about not being clear. Is there a way to add the count into a script?&lt;BR /&gt;</description>
      <pubDate>Wed, 27 Nov 2019 01:28:27 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Count-in-a-script/m-p/236640#M46697</guid>
      <dc:creator>Dennis1</dc:creator>
      <dc:date>2019-11-27T01:28:27Z</dc:date>
    </item>
    <item>
      <title>Re: Count in a script</title>
      <link>https://community.jmp.com/t5/Discussions/Count-in-a-script/m-p/236642#M46699</link>
      <description>&lt;P&gt;Are either of these examples any help?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = current data table();

dt &amp;lt;&amp;lt; new column( "RowNum", format( Row() ) );

dt &amp;lt;&amp;lt; new column( "Counter using a For Loop" );
For( i=1, i&amp;lt;= N Rows(dt), i++,
	dt:Counter using a For Loop[i] = i;
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Nov 2019 01:39:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Count-in-a-script/m-p/236642#M46699</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2019-11-27T01:39:31Z</dc:date>
    </item>
    <item>
      <title>Re: Count in a script</title>
      <link>https://community.jmp.com/t5/Discussions/Count-in-a-script/m-p/236646#M46702</link>
      <description>Hi,&lt;BR /&gt;Thanks for the suggestion.&lt;BR /&gt;I am trying to get it to work, but it still does not generation a column&lt;BR /&gt;with number 1,2,3,....etc.&lt;BR /&gt;I will keep trying.&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;</description>
      <pubDate>Wed, 27 Nov 2019 06:04:27 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Count-in-a-script/m-p/236646#M46702</guid>
      <dc:creator>Dennis1</dc:creator>
      <dc:date>2019-11-27T06:04:27Z</dc:date>
    </item>
    <item>
      <title>Re: Count in a script</title>
      <link>https://community.jmp.com/t5/Discussions/Count-in-a-script/m-p/236647#M46703</link>
      <description>&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #333333; cursor: text; font-family: inherit; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 300; letter-spacing: normal; line-height: 1.7142; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;The examples I listed before are assuming that you were adding the columns to an already existing data table.&amp;nbsp; If you are creating a data table from scratch and it does not have any rows defined for it, one needs to use the&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt &amp;lt;&amp;lt; add rows(100);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #333333; cursor: text; font-family: inherit; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 300; letter-spacing: normal; line-height: 1.7142; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;to create empty rows, before one can place values in the cells.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #333333; cursor: text; font-family: inherit; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 300; letter-spacing: normal; line-height: 1.7142; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;Here is a complete example&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
dt=new table("Example");

dt &amp;lt;&amp;lt; new column( "Counter using a For Loop" );
dt &amp;lt;&amp;lt; add rows(100); 
For( i=1, i&amp;lt;= N Rows(dt), i++,
	dt:Counter using a For Loop[i] = i;
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Nov 2019 06:13:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Count-in-a-script/m-p/236647#M46703</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2019-11-27T06:13:17Z</dc:date>
    </item>
    <item>
      <title>Re: Count in a script</title>
      <link>https://community.jmp.com/t5/Discussions/Count-in-a-script/m-p/236648#M46704</link>
      <description>Thank you, that's awesome! I got it to work.&lt;BR /&gt;&lt;BR /&gt;I just have one more question. If I don't know the exact number of rows&lt;BR /&gt;generated (due to text file size variation), is there a way to read the&lt;BR /&gt;text file and have the exact rows for the counter?&lt;BR /&gt;</description>
      <pubDate>Wed, 27 Nov 2019 07:36:27 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Count-in-a-script/m-p/236648#M46704</guid>
      <dc:creator>Dennis1</dc:creator>
      <dc:date>2019-11-27T07:36:27Z</dc:date>
    </item>
    <item>
      <title>Re: Count in a script</title>
      <link>https://community.jmp.com/t5/Discussions/Count-in-a-script/m-p/236651#M46705</link>
      <description>Thanks for that, works great!&lt;BR /&gt;Much appreciated.&lt;BR /&gt;Cheers,</description>
      <pubDate>Wed, 27 Nov 2019 08:57:33 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Count-in-a-script/m-p/236651#M46705</guid>
      <dc:creator>Dennis1</dc:creator>
      <dc:date>2019-11-27T08:57:33Z</dc:date>
    </item>
  </channel>
</rss>

