Problem
Sie haben eine Tabelle geöffnet, um einen Bericht anzuzeigen. Die Tabelle ist möglicherweise temporär oder unsichtbar, und Sie möchten, dass die Tabelle beim Schließen des Berichts automatisch gelöscht wird.
Lösung
Verwenden Sie die << OnClose-Methode, um ein Skript an den Bericht anzuhängen. Lassen Sie das Skript die Tabelle schließen.
// 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 attachedPlattform mit << OnClose-Ereignis
Diskussion
Sie können das Startfenster verwenden, um die unsichtbare Datentabelle sichtbar zu machen. Vor dem SetDirty (0) werden möglicherweise die << RunFormulas benötigt, um sicherzustellen, dass die Auswertung der Hintergrundformel die Tabelle nicht erneut als schmutzig markiert. Das "nosave" verhindert auch die Aufforderung zur Dirty-Tabelle, jedoch nicht, wenn der Benutzer die Tabelle anstelle des Berichts schließt.
Siehe auch
http://www.pega-analytics.co.uk/blog/housekeeping/