<?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: Extract Max number from a column and feed it to a for loop in the same jsl script in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Extract-Max-number-from-a-column-and-feed-it-to-a-for-loop-in/m-p/761996#M94022</link>
    <description>&lt;P&gt;Here is the max value extraction from Column A.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;X = Eval(Col Max(:Name("Column A")));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then when I use that as, for (i=1, i&amp;lt;=X ...&lt;/P&gt;&lt;P&gt;This for loop does not run. I checked that X is reporting the right number.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 29 May 2024 16:57:39 GMT</pubDate>
    <dc:creator>AsymptoticCos</dc:creator>
    <dc:date>2024-05-29T16:57:39Z</dc:date>
    <item>
      <title>Extract Max number from a column and feed it to a for loop in the same jsl script</title>
      <link>https://community.jmp.com/t5/Discussions/Extract-Max-number-from-a-column-and-feed-it-to-a-for-loop-in/m-p/761994#M94020</link>
      <description>&lt;P&gt;My JSL script has 3 parts. In the first part, I am creating a numeric column (Column A) with 100 rows filled with random integers between 50-1000.&lt;/P&gt;&lt;P&gt;In the 2nd part, I am extracting the max number in Column A and storing it to a variable i.&lt;/P&gt;&lt;P&gt;In the 3rd part, I am using i to create a for loop that creates i number of new columns in the same table. How can I do this?&amp;nbsp;&lt;/P&gt;&lt;P&gt;It seems I can store the data in i but the for loop is not running.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2024 16:34:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Extract-Max-number-from-a-column-and-feed-it-to-a-for-loop-in/m-p/761994#M94020</guid>
      <dc:creator>AsymptoticCos</dc:creator>
      <dc:date>2024-05-29T16:34:23Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Max number from a column and feed it to a for loop in the same jsl script</title>
      <link>https://community.jmp.com/t5/Discussions/Extract-Max-number-from-a-column-and-feed-it-to-a-for-loop-in/m-p/761995#M94021</link>
      <description>&lt;P&gt;Could you post what you have tried?&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2024 16:52:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Extract-Max-number-from-a-column-and-feed-it-to-a-for-loop-in/m-p/761995#M94021</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-05-29T16:52:50Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Max number from a column and feed it to a for loop in the same jsl script</title>
      <link>https://community.jmp.com/t5/Discussions/Extract-Max-number-from-a-column-and-feed-it-to-a-for-loop-in/m-p/761996#M94022</link>
      <description>&lt;P&gt;Here is the max value extraction from Column A.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;X = Eval(Col Max(:Name("Column A")));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then when I use that as, for (i=1, i&amp;lt;=X ...&lt;/P&gt;&lt;P&gt;This for loop does not run. I checked that X is reporting the right number.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2024 16:57:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Extract-Max-number-from-a-column-and-feed-it-to-a-for-loop-in/m-p/761996#M94022</guid>
      <dc:creator>AsymptoticCos</dc:creator>
      <dc:date>2024-05-29T16:57:39Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Max number from a column and feed it to a for loop in the same jsl script</title>
      <link>https://community.jmp.com/t5/Discussions/Extract-Max-number-from-a-column-and-feed-it-to-a-for-loop-in/m-p/761997#M94023</link>
      <description>&lt;P&gt;You didn't post your code so difficult to say what is wrong. Here is working example&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = New Table("",
	Add Rows(100),
	New Column("ColumnA", Numeric, Continuous, Formula(Random Integer(50, 1000)))
);

max = Col Max(Column(dt, "ColumnA"));

For(i = 1, i &amp;lt;= max, i++,
	dt &amp;lt;&amp;lt; New Column(Char(i), Numeric, Continuous, Set Each Value(i));
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 May 2024 17:02:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Extract-Max-number-from-a-column-and-feed-it-to-a-for-loop-in/m-p/761997#M94023</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-05-29T17:02:55Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Max number from a column and feed it to a for loop in the same jsl script</title>
      <link>https://community.jmp.com/t5/Discussions/Extract-Max-number-from-a-column-and-feed-it-to-a-for-loop-in/m-p/761998#M94024</link>
      <description>&lt;P&gt;This code has the same problem as my code. When I run your code it does not create the columns that should have been created by the for loop. I am using JMP 14 so a bit older version.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2024 17:07:22 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Extract-Max-number-from-a-column-and-feed-it-to-a-for-loop-in/m-p/761998#M94024</guid>
      <dc:creator>AsymptoticCos</dc:creator>
      <dc:date>2024-05-29T17:07:22Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Max number from a column and feed it to a for loop in the same jsl script</title>
      <link>https://community.jmp.com/t5/Discussions/Extract-Max-number-from-a-column-and-feed-it-to-a-for-loop-in/m-p/761999#M94025</link>
      <description>&lt;P&gt;Are you getting error message? Are your columns being created but they have incorrect values? You said that for loop doesn't run but now it isn't creating columns (those are most likely separate issues). If you add Show(i); inside your loop does it print those values correctly to log?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = New Table("",
	Add Rows(100),
	New Column("ColumnA", Numeric, Continuous, Formula(Random Integer(50, 1000)))
);

max = Col Max(Column(dt, "ColumnA"));

For(i = 1, i &amp;lt;= max, i++,
	Show(i);
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 May 2024 17:10:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Extract-Max-number-from-a-column-and-feed-it-to-a-for-loop-in/m-p/761999#M94025</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-05-29T17:10:26Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Max number from a column and feed it to a for loop in the same jsl script</title>
      <link>https://community.jmp.com/t5/Discussions/Extract-Max-number-from-a-column-and-feed-it-to-a-for-loop-in/m-p/762000#M94026</link>
      <description>&lt;P&gt;When I run this, I only see /*; in the log.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2024 17:15:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Extract-Max-number-from-a-column-and-feed-it-to-a-for-loop-in/m-p/762000#M94026</guid>
      <dc:creator>AsymptoticCos</dc:creator>
      <dc:date>2024-05-29T17:15:35Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Max number from a column and feed it to a for loop in the same jsl script</title>
      <link>https://community.jmp.com/t5/Discussions/Extract-Max-number-from-a-column-and-feed-it-to-a-for-loop-in/m-p/762005#M94028</link>
      <description>&lt;P&gt;As I don't have access to JMP14 I have to just guess what could be different.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe loop isn't run at all -&amp;gt; add debug print for max&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = New Table("",
	Add Rows(100),
	New Column("ColumnA", Numeric, Continuous, Formula(Random Integer(50, 1000)))
);

max = Col Max(Column(dt, "ColumnA"));
Show(max);

For(i = 1, i &amp;lt;= max, i++,
	Show(i);
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;other debug case, try loop without the table&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
max = 10;

For(i = 1, i &amp;lt;= max, i++,
	Show(i);
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If JMP14 did have Debugger (and you can get that working as that might not be that easy) you could also try that&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1717003401520.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/64627iC0B7AA57EB3252CC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1717003401520.png" alt="jthi_0-1717003401520.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2024 17:23:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Extract-Max-number-from-a-column-and-feed-it-to-a-for-loop-in/m-p/762005#M94028</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-05-29T17:23:44Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Max number from a column and feed it to a for loop in the same jsl script</title>
      <link>https://community.jmp.com/t5/Discussions/Extract-Max-number-from-a-column-and-feed-it-to-a-for-loop-in/m-p/762010#M94031</link>
      <description>&lt;P&gt;Here is a real simple example......&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = 
// Open Data Table: Blood Pressure.jmp
// → Data Table( "Blood Pressure" )
Open( "$SAMPLE_DATA/Blood Pressure.jmp" );

dt &amp;lt;&amp;lt; New Column( "A", formula( Random Integer( 50, 1000 ) ) );

i = Col Max( dt:A );

For( k = 1, k &amp;lt;= i, k++,
	dt &amp;lt;&amp;lt; New Column( "col" || Char( k ) )
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 May 2024 19:23:22 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Extract-Max-number-from-a-column-and-feed-it-to-a-for-loop-in/m-p/762010#M94031</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-05-29T19:23:22Z</dc:date>
    </item>
  </channel>
</rss>

