cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
Yngeinstn
Level IV

Help with Data Filter Context Box()

I am having trouble inserting a Data Filter Context Box into my script. My script is used to pull in data via SQL, perform some table functions and then spitting out graphs inside of tabbed windows. This makes it visually nicer than what i was doing as every singe output had a new window associated with it and the Test Engineers would have to click on multiple buttons.

 

I have read these boards as well as reading the scripting guide. The problem i have is how to insert this after the graphs plots and distributions are populated. From the scripting guide.

I tried to use the same philosophy that Mr. txnelson helped me with but I can't get it to create a temp box and then populate after click my buttons. Again, any and all help is appreciated.

 

d

guide,

 

// ---------------------------  From Scripting Guide -------------------------
dt = Open( "$SAMPLE_DATA/Hollywood Movies.jmp" );
	win = New Window( "Shared Local Filter",
		Data Filter Context Box(
// enclose the h list box that contains distribution and graph builder
			H List Box(
// add the local data filter 
// NOTE: My tables aren't created yet so i am getting an error here.
				dt << Data Filter( Local ),  
				dt << Distribution(
					Weight( :Profitability ),
						Nominal Distribution( 
							Column( :Lead Studio Name ) 
						),
						Nominal Distribution( 
							Column( :Genre ) 
						),
					Histograms Only
				),
				dt << Graph Builder(
					Variables(
						X( :Genre ),
						Y( :Domestic Gross ),
						Y( :Foreign Gross, Position( 1 ) )
					),
					Show Control Panel( 0 ),
					Elements(
						Bar( X, Y( 1 ), Y( 2 ),
							Legend( 2 ),
							Bar Style( "Side by side" ),
							Summary Statistic( "Mean" )
						),
						Frequencies( 0 ),
					)
				)
			)
		)
	);

// --------------------------- My Data Pull Script Simplified -------------------------

Names Default To Here( 1 );

Close All( Data Tables, No Save );
Close All( Reports );
Clear Log();
Close All( journals, no save );
Clear Symbols();

sqlstartA = Today();
sqlendA = Today();
sqlstart = Format( sqlstartA, "yyyy-mm-dd" );
sqlend = Format( sqlendA, "yyyy-mm-dd" );

/************************************************************************************************************************************************/
/*                                                                         	  																	*/
/* ---------------------------------------------------------------[START EXAMPLE] -----------------------------------------------------------	*/
/*                                                                        																		*/
/************************************************************************************************************************************************/

hay = New Window( "Test Database Tools",
	V List Box(
		V List Box(
			Text Box(
				"Product Engineering Database Tools",
				<<Set Font Size( 20 ),
				<<Set Font Style( "Bold" ),
				<<Set Min Size( 800, 36 ),
				<<Set Max Size( 800, 36 ),
				<<Set Width( 1900 ),
				<<Set Wrap( 1070 ),
				<<Justify Text( "Center" )
			),
			Spacer Box( Size( 10, 15 ) ),
			H List Box(
				bb = Border Box( Left( 15 ), Right( 10 ), Top( 10 ), Bottom( 10 ), Sides( 15 ),
					V List Box(
						lineup1 = Lineup Box( N Col( 1 ),
							V List Box(
								lineup = Lineup Box( N Col( 1 ),
									Text Box( "Select Desired Test Dates", <<Set Font Size( 20 ), <<Justify Text( "Center" ) ),
									Spacer Box( Size( 5, 15 ) ),
									H Splitter Box(
										Border Box( Left( 15 ), Right( 10 ), Top( 10 ), Bottom( 10 ), Sides( 15 ),
											StartDate = Calendar Box(
												<<Set Function( Function( {f1}, sqlStartA = StartDate << Get Date() ) )
											)
										),
										Border Box( Left( 15 ), Right( 10 ), Top( 10 ), Bottom( 10 ), Sides( 15 ),
											EndDate = Calendar Box(
												<<Set Function( Function( {f2}, sqlendA = EndDate << Get Date() ) )
											)
										)
									)
								)
							),
							Spacer Box( Size( 5, 5 ) ),
							
/****************************************************/
/* Selecting Start And End Date Not Required		*/
/****************************************************/
							
							waferlist = Button Box( "Click Here When Finished",
								sqlstart = Format( sqlstartA, "yyyy-mm-dd" );
								sqlend = Format( sqlendA, "yyyy-mm-dd" );
								Show( sqlstart, sqlend );
								lineup1 << Append(
									V List Box(
										Spacer Box( Size( 5, 5 ) ), 

										Text Box( "Select Your Wafer(s)", <<Set Font Size( 15 ), <<Justify Text( "Center" ) ),
										Spacer Box( Size( 5, 15 ) ),
										loaddata = Button Box( "Load The Test Data",
											dt = Open( "$SAMPLE_DATA/big class.jmp", invisible );

/****************************************************/
/* Distribution, Graph and Fit Y By X Plots	    */
/****************************************************/
											
								
											distr << Delete;
											plot << Delete;
											fitYbyX << Delete;
											
											distr = V List Box( Distribution( Continuous Distribution( Column( :height ) ) ) );
											distrvlb << append( distr );
											
											plot = V List Box(
												Graph Builder(
													Size( 524, 454 ),
													Show Control Panel( 0 ),
													Variables( X( :height ), Y( :age ), Overlay( :sex ) ),
													Elements( Smoother( X, Y, Legend( 4 ) ) )
												)
											);
											plotvlb << append( plot );
											
											fitYbyX = V List Box( Oneway( Y( :height ), X( :age ) );
											);
											
											fitYbyXvlb << Append( fitYbyX ); 
										)
									)
								)
							)
						)
					)
				), 
				
// Creates Tabed Windows for Test Data Information
// Temp Windows that get filled once the data is loaded				
				Tab Box(
					"Example",
					V List Box(
						H List Box(
							distrvlb = V List Box( distr = Graph Box() ),
							plotvlb = V List Box( plot = Graph Box() ),
							fitYbyXvlb = V List Box( fitYbyX = Graph Box() )
						),

					)
				)
			)
		)
	)
) << Maximize Window;

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Help with Data Filter Context Box()

Yes, I first noticed that the "Load The Test Data" duplicates parts of the interface (the filter), and as you point out the "Click Here When Finished" also duplicates UI.  You mentioned that you were having trouble deleting the box, but I wasn't sure if you wanted to (a) delete the controls so that they can only be used once (b) delete the filter so that you can replace it with another.  My previous response was to demonstrate a way to to (a) without actually having to delete anything - just hide and show different parts of the window depending on the state.

 

Attached is another modification of the script that I changed to delete the components.  I save a reference to the boxes that are added to the display.  Each time the boxes are added it will first call << Delete Box on the previously added boxes.

View solution in original post

14 REPLIES 14
txnelson
Super User

Re: Help with Data Filter Context Box()

Are you looking to add a local data filter(s), for specified charts/graphs?

Are you looking to add a filter that changes all of the charts based upon a single filter?

Are you looking to have the user click on a one of the bars in the histogram, and from the rows selected, change the othe charts and graphs?

 

Attached is a modification of your script that adds in a data filter to the left of the Distribution Platform output, and when selected, changes all of the charts attached to the data table.

 

Jim
Yngeinstn
Level IV

Re: Help with Data Filter Context Box()

Sorry for not specifying.

 

Yes a local data filter that effects all charts in the tab,.. I will look at your script in a moment.

 

Thank You

Yngeinstn
Level IV

Re: Help with Data Filter Context Box()

Mr. Nelson,

 

I tried to put that into my script and it seems that it is only updating a portion of the graphs / distributions.  I have attached an updated script that is exactly what i am trying to do with the additions of a couple of other tabs behind the two that you see.

 

I have also attached a good example of a dataset i am pulling in. This table includes 3 wafers worth of data to give you an idea.

 

Additionally, I would like to know if there is a way to resize the calendar boxes so that they take up less room which leaves more for the analysis.

 

Thanks

txnelson
Super User

Re: Help with Data Filter Context Box()

The reason your Distribution is not changing when you change selections in your Data Filter, is because the "Automatic Recalc(1)" option is not set in the JSL for the Distributions.

Concerning the resizing of the Calendar Boxes, I do not see a way to change their size. Some other Community Member may have a method, but I can not find one.
Jim
Yngeinstn
Level IV

Re: Help with Data Filter Context Box()

That makes complete sense . Thank you for your assistance.

Re: Help with Data Filter Context Box()

I have attached an updated version of your script.  As Jim points out, Automatic Recalc is not set on the Distribution.  The reason for this is that your data filters are global filters, and not local filters.  In your script, notice that while all reports appear to update, the Data Table row states are changing, and results are updating on both tabs.

 

I've made two changes to make the filters local:

  1. Add "Local" option to Data Filter() commands
  2. Changed your HListBox() to a Data Filter Context Box() on each tab.  This keeps the effect of each filter local to the tab

 

The Local Data Filter will automatically set the Auto Recalc flag on each associated platform.

 

I do not know of a way to make the calendar smaller.  I'm not sure what workflow you are going for after the initial date selection.  You might consider two windows, a launcher window with date selection and a result window showing the reports.  You could include the date range as a subtitle.

 

If you want to keep both in the same window, you could put the calendars inside an outline node that using <<Outline Close Orientation("Vertical") and automatically close the dates when the reports are populated.  You would probably also want to look at the case where "Load Test Data" is pressed multiple times.  Currently it will append a filter each time the button is pressed.

Re: Help with Data Filter Context Box()

While you cannot re-size the Calendar Box object, you can use a Number Edit Box instead for the same purpose. Set the format to the date style you want and then it will present a calendar during interaction but otherwise it is only a small box.

 

Names Default to Here( 1 );

nw = New Window( "Date Entry",
	Outline Box( "Calendar Box Substitute",
		neb = Number Edit Box( 01Jan2019,
			<< Set Format( Format( "m/d/y", 12 ) )
		)
	),
	H List Box(
		Button Box( "OK",
			date = neb << Get;
		),
		Button Box( "Cancel" )
	)
);
Yngeinstn
Level IV

Re: Help with Data Filter Context Box()

Thank you your's and Jim's help. I didn't think about the automatic recalc at all. And a special thanks for the Data Filter Context Box() addition. I was trying to use that but couldn't figure out the correct placement.

 

As for the calendar, i completely agree with you. Make it an outline box that can open and close..

 

The main window requires some additions and tweeks once i get all the graphs, distributions, Fit Y by X and Wafer Maps (semiconductor toolkit) in the appropriate windows. The issues you and Jim are helping with are the low hanging fruit when it comes to this analysis tool. I feel that the biggest hurdle is going to be how i handle the outliers. I found GrubbsOutlierTest3.jsl on these boards and will use this is some way, shape or form.

 

Thank You again.

 

d

Yngeinstn
Level IV

Re: Help with Data Filter Context Box()

As you pointed out in your reply the issue with " Click Here When Finished" appends the window when it is clicked. I have tried to << Delete the Box() and a few other things that have been unsuccessful. I have however, managed to do insert some Throw() statements when no dates or wafers were selected. This one is proving to be challenging. Any suggestions?