cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
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;

 

14 REPLIES 14
Yngeinstn
Level IV

Re: Help with Data Filter Context Box()

I belive i can accomplish the appending that window by using a for loop. Just exactly how i put code the i < =

 

Thank You

 

 

For( i = 1, i <= /* not sure what i would put in here */ , i ++,
    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 = current data table();
//        dt = Open( "$SAMPLE_DATA/big class.jmp", invisible )

// Insert End of Script

 

 

Re: Help with Data Filter Context Box()

I'm not clear on what you are trying to do inside the loop.  If you want the controls to go away, you could either delete them or you can just hide them.  Hiding them may not be ideal - they are still in the display tree - but this is a common approach.  Here's an example that takes the user through multiple steps of input, hiding the controls at each step:

 

New Window( "Wizard Interface",
	top = H List Box(
		// Control panels
		controls = Panel Box( "Inputs",
			panel1 = V List Box(
				Text Box("Panel 1"),
				Button Box( "Next",
					panel1 << Visibility( "Collapse" );
					panel2 << Visibility( "Visible" );
				)
			),
			panel2 = V List Box(
				Text Box("Panel 2"),
				Button Box( "Next",
					panel2 << Visibility( "Collapse" );
					panel3 << Visibility( "Visible" );
				),
				<<Visibility( "Collapse" )
			),
			panel3 = V List Box(
				Text Box("Panel 3"),
				Button Box( "Next",
					controls << Visibility( "Collapse" );
					top << Append( Panel Box( "Report windows" ) );
				),
				<<Visibility( "Collapse" )
			)
		)
	)
)

Is this similar to what you want to do?

Yngeinstn
Level IV

Re: Help with Data Filter Context Box()

My apologies. If you run the script that you fixed and click the button "Click here when finished" it keeps appending the display box. I could have sworn you pointed that when you replied but now i realize it was related to a different topic.

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.

Yngeinstn
Level IV

Re: Help with Data Filter Context Box()

That worked perfect, thank you. I have to read up on "Is Scriptable" and see how else it could be used