Script para verificar si una tabla o análisis está activoHola a todos,
Me preguntaba si hay alguna manera de saber si está trabajando en una tabla de datos o en una ventana de análisis.Me gustaría tener una declaración if para que, si estás en una tabla de datos, el script haga una cosa, y si estás en una ventana de análisis, el script hará otra cosa.
¡Gracias por cualquier idea!
Steve
ScriptingRe: Script para verificar si una tabla o análisis está activoDebería poder comprobar qué ventana está activa con Obtener título de ventana y usar eso con Try-structure con Tabla de datos (referencia) << obtener nombre (o N filas (tabla de datos (referencia) por ejemplo.
Ejemplo:
Names Default To Here(1);<BR />Open("$SAMPLE_DATA/Consumer Preferences.jmp");<BR />wait(2);<BR />curWindow = current window() << Get Window Title; //get window title to curWindow variable<BR />//use Try to check if curWindow is datatable with << Get name or N Rows<BR />Try(<BR />//Show(N Rows(Datatable(curWindow))),<BR />Write(Datatable(curWindow) << Get Name || " --- this is datatable\!N"), //datatable<BR />Write(curWindow || " --- this is not datatable\!N"); //not datatable<BR />);<BR />wait(1);<BR />//create "analysis" which should became active<BR />nw = New Window("Consumer Preferences",<BR />Graph Builder(<BR />Size(495, 450),<BR />Show Control Panel(0),<BR />Variables(X(:Single Status)),<BR />Elements(Points(X, Legend(2)))<BR />);<BR />);<BR />wait(1);<BR />//repeat test used earlier<BR />curWindow = current window() << Get Window Title;<BR />Try(<BR />Write(Datatable(curWindow) << Get Name || " --- this is datatable"), //datatable<BR />Write(curWindow || " --- this is not datatable"); //not datatable<BR />);
Re: Script para verificar si una tabla o análisis está activo¡Gracias por la rápida solución!