<?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: table is empty when being referenced in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/table-is-empty-when-being-referenced/m-p/66875#M34516</link>
    <description>&lt;P&gt;wait(n) is not the best solution; it is hard to know if n is big enough. JMP evaluates the table formulas in the background. The best way to make sure they have evaluated is&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;ret &amp;lt;&amp;lt; RunFormulas;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;after building the table. It will evaluate the table's formulas faster than waiting for them.&lt;/P&gt;</description>
    <pubDate>Tue, 07 Aug 2018 11:09:08 GMT</pubDate>
    <dc:creator>Craige_Hales</dc:creator>
    <dc:date>2018-08-07T11:09:08Z</dc:date>
    <item>
      <title>table is empty when being referenced</title>
      <link>https://community.jmp.com/t5/Discussions/table-is-empty-when-being-referenced/m-p/66767#M34488</link>
      <description>&lt;P&gt;&amp;nbsp;Hi all!&lt;/P&gt;&lt;P&gt;I tried to&amp;nbsp;select a column in a generated data table and transform that column into a new data table. Following is my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;//part 1: generate a data table&lt;BR /&gt;ret = New Table( title,
	Add Rows (rowNum),
	New Column( "P", Expression, "Continuous", Formula( pmatrix ) ),
	New Column( "X(n)",
		Expression,
		"None",
		Formula( If( Row() == 1, init_state, Lag( :Name( "X(n)" ), 1 ) * :P ) ),
		Set Selected,

	),
	New Column( "steady state",
		Expression,
		"None",
		Formula( :Name( "X(n)" ) - Lag( :Name( "X(n)" ) ) == zeros ),

	),
	New Column( "States", Character, Values( names ) ),
);
// part 2: select column X(n) and transform it into a new table 
&lt;STRONG&gt;mat = Column(ret,"X(n)")[1];
show(mat);&lt;/STRONG&gt;
For(i = 2, i &amp;lt;= N Rows(ret), i++,
	V Concat To(mat,Column(ret,"X(n)")[i]);
);
table = As Table(mat);
names = Column(ret, "States") &amp;lt;&amp;lt; get values;
For(i = 1, i &amp;lt;= N Col(table), i++,
	Column(i) &amp;lt;&amp;lt; Set Name( names[i] );
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;When I tested the two parts seperately by saving the result table in part 1 and then running part 2, it works. But I don't want to save the table in part 1 everytime before running part 2 so I put them together. However, the merged script doesn't work. In this case, the table returned by part 2 only has missing values (Empty()).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I add "show(mat);" in the script to see what happened and it shows "mat = Empty();" in the log. The expected value of mat should be a vector as in each row of Column X(n) of the data table in part 1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't know what went wrong. Any help would be appreciated!&lt;/P&gt;</description>
      <pubDate>Mon, 06 Aug 2018 20:46:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/table-is-empty-when-being-referenced/m-p/66767#M34488</guid>
      <dc:creator>vistacc</dc:creator>
      <dc:date>2018-08-06T20:46:15Z</dc:date>
    </item>
    <item>
      <title>Re: table is empty when being referenced</title>
      <link>https://community.jmp.com/t5/Discussions/table-is-empty-when-being-referenced/m-p/66769#M34490</link>
      <description>&lt;P&gt;I do not see the reference to the variable "ret".&amp;nbsp; In the second half of the code, ret is used, but not in the 1st half......&lt;/P&gt;</description>
      <pubDate>Mon, 06 Aug 2018 21:02:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/table-is-empty-when-being-referenced/m-p/66769#M34490</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2018-08-06T21:02:45Z</dc:date>
    </item>
    <item>
      <title>Re: table is empty when being referenced</title>
      <link>https://community.jmp.com/t5/Discussions/table-is-empty-when-being-referenced/m-p/66773#M34493</link>
      <description>&lt;P&gt;Sorry. Don't know why something went wrong with the format. The first line of the script is commented...&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;	ret = New Table( 
		Add Rows (rownum),
		New Column( "P", Expression, "Continuous", Formula( ptable &amp;lt;&amp;lt; get as matrix ) ),
		New Column( "X(n)",
			Expression,
			"None",
			Formula( If( Row() == 1, init_state, Lag( :Name( "X(n)" ), 1 ) * :P ) ),
			Set Selected,

		),
		New Column( "steady state",
			Expression,
			"None",
			Formula( :Name( "X(n)" ) - Lag( :Name( "X(n)" ) ) == zeros ),

		),
		New Column( "States", Character, Values( names ) ),

	);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Aug 2018 21:23:07 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/table-is-empty-when-being-referenced/m-p/66773#M34493</guid>
      <dc:creator>vistacc</dc:creator>
      <dc:date>2018-08-06T21:23:07Z</dc:date>
    </item>
    <item>
      <title>Re: table is empty when being referenced</title>
      <link>https://community.jmp.com/t5/Discussions/table-is-empty-when-being-referenced/m-p/66775#M34495</link>
      <description>&lt;P&gt;I found a solution that can&amp;nbsp;solve my problem: adding "wait(1)" between the two parts will work. (reference:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.jmp.com/t5/Discussions/Add-new-column-with-formula-to-data-table-at-certain-position/td-p/14602).&amp;nbsp;" target="_blank"&gt;https://community.jmp.com/t5/Discussions/Add-new-column-with-formula-to-data-table-at-certain-position/td-p/14602).&amp;nbsp;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;but I don't understand why this works... Is there any other way that can also address this problem?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Aug 2018 21:35:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/table-is-empty-when-being-referenced/m-p/66775#M34495</guid>
      <dc:creator>vistacc</dc:creator>
      <dc:date>2018-08-06T21:35:21Z</dc:date>
    </item>
    <item>
      <title>Re: table is empty when being referenced</title>
      <link>https://community.jmp.com/t5/Discussions/table-is-empty-when-being-referenced/m-p/66875#M34516</link>
      <description>&lt;P&gt;wait(n) is not the best solution; it is hard to know if n is big enough. JMP evaluates the table formulas in the background. The best way to make sure they have evaluated is&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;ret &amp;lt;&amp;lt; RunFormulas;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;after building the table. It will evaluate the table's formulas faster than waiting for them.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Aug 2018 11:09:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/table-is-empty-when-being-referenced/m-p/66875#M34516</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2018-08-07T11:09:08Z</dc:date>
    </item>
    <item>
      <title>Re: table is empty when being referenced</title>
      <link>https://community.jmp.com/t5/Discussions/table-is-empty-when-being-referenced/m-p/66895#M34518</link>
      <description>&lt;P&gt;And thanks for the report; the column function will do the &amp;lt;&amp;lt;runFormulas internally in JMP 15.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Aug 2018 12:27:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/table-is-empty-when-being-referenced/m-p/66895#M34518</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2018-08-07T12:27:54Z</dc:date>
    </item>
    <item>
      <title>Re: table is empty when being referenced</title>
      <link>https://community.jmp.com/t5/Discussions/table-is-empty-when-being-referenced/m-p/66897#M34520</link>
      <description>Thank you for the reply!</description>
      <pubDate>Tue, 07 Aug 2018 13:27:36 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/table-is-empty-when-being-referenced/m-p/66897#M34520</guid>
      <dc:creator>vistacc</dc:creator>
      <dc:date>2018-08-07T13:27:36Z</dc:date>
    </item>
  </channel>
</rss>

