問題
レポートを表示するためにテーブルを開きました。テーブルは一時的なものでも非表示のものでもかまいません。そのため、レポートが閉じられたときにテーブルは静かに消えてしまいます。
溶液
<< OnCloseメソッドを使用して、スクリプトをレポートに添付します。スクリプトでテーブルを閉じます。
// make a table
dt = New Table( "Temporary",
Add Rows( 1e6 ),
New Column( "x", Formula( Random Normal( 50, 30 ) ) ),
New Column( "y", Formula( Random Normal( 50, 30 ) ) ),
"Invisible"
);
// now make sure the formulas have finished evaluating
dt << RunFormulas;
// then clear the flag that says the table has changes that need to be saved
dt << SetDirty( 0 );
// finally, create a platform (or other window) with an OnClose script.
// the try() captures a message that might happen if the table is
// closed, causing the platform to close, causing the table to close...
dt << Bivariate( Y( :y ), X( :x ), <<ONCLOSE></ONCLOSE>
Platform with <<OnClose event attached<< OnCloseイベントが添付されたプラットフォーム
討論
非表示のデータテーブルを表示するには、ホームウィンドウを使用します。<<式の実行式が<< SetDirty(0)の前に必要になる場合があります。これは、バックグラウンドの式の評価によってテーブルがダーティとしてマークされないようにするためです。"nosave"を実行すると、ダーティテーブルの入力を求めるプロンプトも表示されなくなりますが、ユーザがレポートの代わりにテーブルを閉じた場合は表示されません。
参照
http://www.pega-analytics.co.uk/blog/housekeeping/