<?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: Column Formulas to slow : how to wait until they are done calculating in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Column-Formulas-to-slow-how-to-wait-until-they-are-done/m-p/184806#M40386</link>
    <description>&lt;P&gt;Below is a simple modification that should work for you.&amp;nbsp; First, by getting rid of the If() clause it will speed up the processing, and secondly, the&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; dt &amp;lt;&amp;lt; rerun formulas;&lt;/P&gt;
&lt;P&gt;will force JMP to complete processing on the formulas before continuing&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Current Data Table();
dt &amp;lt;&amp;lt; New Column( "_Target",
	Numeric,
	"Continuous",
	Format( "Best", 12 ),
	Formula( (:LSL + :USL) / 2 )
);
dt &amp;lt;&amp;lt; rerun formulas;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 07 Mar 2019 17:54:45 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2019-03-07T17:54:45Z</dc:date>
    <item>
      <title>Column Formulas to slow : how to wait until they are done calculating</title>
      <link>https://community.jmp.com/t5/Discussions/Column-Formulas-to-slow-how-to-wait-until-they-are-done/m-p/184796#M40384</link>
      <description>&lt;P&gt;Greetings, I have run into situations where I import raw data into a data table (dt1), and then open another data table that has say spec limits (dt2).&amp;nbsp; &amp;nbsp;The spec limits table has an USL and a LSL only.&amp;nbsp; I insert a new calcultated column into dt2 that is the target spec limit (mean(USL,LSL)).&amp;nbsp; &amp;nbsp;I then loop through all rows of my raw data dt1 and if I get a match of the name of the test and spec limits, then set colum properties with the spec limits (e.g., col &amp;lt;&amp;lt; Set Property( "Spec Limits", {LSL( myLSLx ),USL( myUSLx ),Target( mytargetx ), );)... Then close spec file dt2, no save.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think the problem I am having is that the calculated column (dt2:_Target) is not fast enough, and I get all empty values when trying to read them, right after creating the new calculated column("_Target"...).&amp;nbsp; &amp;nbsp;If I keep the dt2 file open, I see the correct values in the calculated column "_Target".&amp;nbsp; &amp;nbsp;I have played with the dt2&amp;lt;&amp;lt; Begin data Update; and that does not work either, but maybe I am putting that in an incorrect location in the script?&amp;nbsp; The only work around I have, is to not use a formula for the new column, but to calculate in a script the target value and place it in the spec file by indexing through all the rows.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The root of my question is, can I wait for all the columns to be completed with calculations before trying to read a specific value in a row/column?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does not work&amp;nbsp;&lt;/P&gt;
&lt;P&gt;E.g,&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;New Column( "_Target",Numeric,"Continuous",Format( "Best", 12 ),Formula(If( Is Missing( :_LSL ) | Is Missing( :_USL ),
&amp;nbsp; &amp;nbsp; Empty(),
Mean( :_LSL, :_USL )
)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Workaround&lt;/P&gt;
&lt;P&gt;E.g.,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt2 = current data table();
New Column( "_Target", Numeric, "Continuous");
dt2_rows = nrows();
for (i=1, i&amp;lt;=dt2_rows, i++,
if(or(!is missing(dt2:_LSL[i]),!is missing(dt2:_USL[i])),
&amp;nbsp; &amp;nbsp;dt2:_Target[i] = ((dt2:_LSL[i]) + (d2t:_USL[i])) / 2;
&amp;nbsp; ,
&amp;nbsp; );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2019 17:49:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Column-Formulas-to-slow-how-to-wait-until-they-are-done/m-p/184796#M40384</guid>
      <dc:creator>justvince</dc:creator>
      <dc:date>2019-03-07T17:49:51Z</dc:date>
    </item>
    <item>
      <title>Re: Column Formulas to slow : how to wait until they are done calculating</title>
      <link>https://community.jmp.com/t5/Discussions/Column-Formulas-to-slow-how-to-wait-until-they-are-done/m-p/184805#M40385</link>
      <description>&lt;P&gt;Try sending your table a 'run formulas' message:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt &amp;lt;&amp;lt; runFormulas;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Mar 2019 17:49:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Column-Formulas-to-slow-how-to-wait-until-they-are-done/m-p/184805#M40385</guid>
      <dc:creator>ian_jmp</dc:creator>
      <dc:date>2019-03-07T17:49:24Z</dc:date>
    </item>
    <item>
      <title>Re: Column Formulas to slow : how to wait until they are done calculating</title>
      <link>https://community.jmp.com/t5/Discussions/Column-Formulas-to-slow-how-to-wait-until-they-are-done/m-p/184806#M40386</link>
      <description>&lt;P&gt;Below is a simple modification that should work for you.&amp;nbsp; First, by getting rid of the If() clause it will speed up the processing, and secondly, the&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; dt &amp;lt;&amp;lt; rerun formulas;&lt;/P&gt;
&lt;P&gt;will force JMP to complete processing on the formulas before continuing&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Current Data Table();
dt &amp;lt;&amp;lt; New Column( "_Target",
	Numeric,
	"Continuous",
	Format( "Best", 12 ),
	Formula( (:LSL + :USL) / 2 )
);
dt &amp;lt;&amp;lt; rerun formulas;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Mar 2019 17:54:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Column-Formulas-to-slow-how-to-wait-until-they-are-done/m-p/184806#M40386</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2019-03-07T17:54:45Z</dc:date>
    </item>
    <item>
      <title>Re: Column Formulas to slow : how to wait until they are done calculating</title>
      <link>https://community.jmp.com/t5/Discussions/Column-Formulas-to-slow-how-to-wait-until-they-are-done/m-p/184890#M40398</link>
      <description>Awesome! It works!</description>
      <pubDate>Thu, 07 Mar 2019 20:47:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Column-Formulas-to-slow-how-to-wait-until-they-are-done/m-p/184890#M40398</guid>
      <dc:creator>justvince</dc:creator>
      <dc:date>2019-03-07T20:47:15Z</dc:date>
    </item>
    <item>
      <title>Re: Column Formulas to slow : how to wait until they are done calculating</title>
      <link>https://community.jmp.com/t5/Discussions/Column-Formulas-to-slow-how-to-wait-until-they-are-done/m-p/184891#M40399</link>
      <description>NIce, This works too. The rerun formulas is not in the JMP V13 scripting guide, while run formulas is. Both work in this case.</description>
      <pubDate>Thu, 07 Mar 2019 20:47:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Column-Formulas-to-slow-how-to-wait-until-they-are-done/m-p/184891#M40399</guid>
      <dc:creator>justvince</dc:creator>
      <dc:date>2019-03-07T20:47:17Z</dc:date>
    </item>
    <item>
      <title>Re: Column Formulas to slow : how to wait until they are done calculating</title>
      <link>https://community.jmp.com/t5/Discussions/Column-Formulas-to-slow-how-to-wait-until-they-are-done/m-p/184915#M40404</link>
      <description>&lt;P&gt;Was not aware of "rerun" either. Looks like it makes the formulas re-evaluate, whether they need it or not. If you use random numbers in your formulas, you can see the difference. I'd recommend &amp;lt;&amp;lt;runFormulas for most cases.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2019 21:35:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Column-Formulas-to-slow-how-to-wait-until-they-are-done/m-p/184915#M40404</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2019-03-07T21:35:41Z</dc:date>
    </item>
    <item>
      <title>Re: Column Formulas to slow : how to wait until they are done calculating</title>
      <link>https://community.jmp.com/t5/Discussions/Column-Formulas-to-slow-how-to-wait-until-they-are-done/m-p/185158#M40412</link>
      <description>&lt;P&gt;You are correct that this message is not described in the Scripting Guide. It is described in the JSL Syntax Guide. The first book is not a complete description of every function and message in JSL but the second book should be complete. The two books are meant to complement each other and to be used together.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The message is also covered by the Scripting Index, with a link to the help for it. A search for 'formula' would return a list including the &amp;nbsp;&amp;lt;&amp;lt; Run Formulas and &amp;lt;&amp;lt; Rerun Formulas messages.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2019 12:41:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Column-Formulas-to-slow-how-to-wait-until-they-are-done/m-p/185158#M40412</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2019-03-08T12:41:02Z</dc:date>
    </item>
    <item>
      <title>Re: Column Formulas to slow : how to wait until they are done calculating</title>
      <link>https://community.jmp.com/t5/Discussions/Column-Formulas-to-slow-how-to-wait-until-they-are-done/m-p/186274#M40470</link>
      <description>&lt;P&gt;This is a simple "pile on" comment.&amp;nbsp; &amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;'s formula will run fatser than the one you provided.&amp;nbsp; Column formulas run faster than a for loop. Also, the conditional statement is not required, since JMP returns an empty() in any calculation that has an empty value. Thus,&amp;nbsp; (:USL + :LSL)/2&amp;nbsp; will be empty if any one or both values are empty.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is just an FYI.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2019 10:20:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Column-Formulas-to-slow-how-to-wait-until-they-are-done/m-p/186274#M40470</guid>
      <dc:creator>gzmorgan0</dc:creator>
      <dc:date>2019-03-12T10:20:16Z</dc:date>
    </item>
  </channel>
</rss>

