cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
shampton82
Level VII

Data table reports windows

Hey everyone,

Could anyone show me the way with JSL to get all the reports that are open against a data table? What I'm trying to do is be able to click a script button and minimize all the reports that are open for a selected data table.

 

Thanks for any ideas!

 

Steve

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Data table reports windows

I am not aware of a direct way to do this, but the below script seems to work

Names Default To Here( 1 );
dt = Current Data Table();

windowNumbersToMinList = {};
theName = Current Data Table() << get name;

// Loop across all windows and find report windos attached to data table name
// Definition of a report window, is one that starts with the data table name and
// is followed by a "-"
i = 1;
While( Window( i ) << get window title != {},
	theWName = Window( i ) << get window title;
	If( Contains( theWName, theName ) == 1 & Substr( theWName, Length( theName ) + 2, 1 ) == "-",
		Insert Into( windowNumbersToMinList, i )
	);
	i++;
);

// Loop across found windows and minimize them
If( N Items( windowNumbersToMinList ) > 0,
	For( i = N Items( windowNumbersToMinList ), i >= 1, i--,
		Window( windowNumbersToMinList[i] ) << minimize window
	)
);
Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: Data table reports windows

I am not aware of a direct way to do this, but the below script seems to work

Names Default To Here( 1 );
dt = Current Data Table();

windowNumbersToMinList = {};
theName = Current Data Table() << get name;

// Loop across all windows and find report windos attached to data table name
// Definition of a report window, is one that starts with the data table name and
// is followed by a "-"
i = 1;
While( Window( i ) << get window title != {},
	theWName = Window( i ) << get window title;
	If( Contains( theWName, theName ) == 1 & Substr( theWName, Length( theName ) + 2, 1 ) == "-",
		Insert Into( windowNumbersToMinList, i )
	);
	i++;
);

// Loop across found windows and minimize them
If( N Items( windowNumbersToMinList ) > 0,
	For( i = N Items( windowNumbersToMinList ), i >= 1, i--,
		Window( windowNumbersToMinList[i] ) << minimize window
	)
);
Jim
shampton82
Level VII

Re: Data table reports windows

Works perfect, thanks!