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

Do "work" when you select an item in the Data Filter

I am having trouble figuring out how to do "work" when you select a item in the data filter. When i select a condition I would like the script to go to my Limits Table and then populate an expression that i use for a Graphics Script. This will change based on the "where" statement from the data filter. I don't know how to get the script to trigger this action or how do you delete it if i were to change to a different data filter selection. I apologize in advance as i don't have the entire script or a sample data table. If more information is needed I will try my best to get some.

 

Thanks

 

// Step 1: Go to the textbox with "Where" statement

Try( test = Report( gb1_S.2 )[Text Box( 5 )] << Get Text );
graph = dt_lim << Get Rows Where( Contains( test, :SPEC_COL_NAMES ) );

// Step 2: If a condition exists, populate the following

f1 = Column( dt_lim, "StartF" )[graph][1]; // x1 for a Marker and starting point for the line
f2 = Column( dt_lim, "StartF" )[graph][2]; // x2 for a Marker and starting point for the line
s1 = (Column( dt_lim, "LSL" )[graph])[1]; // y1 (LSL) for the Line
s2 = (Column( dt_lim, "USL" )[graph])[1]; // y2 (USL) for the Line

color = "Red";

test = Expr(
	
	graph_expr = Eval Insert(
		"\[Graph_Script = Expr(
			Marker Size( 6 );
			Marker( Marker State( 20 ), Color State( "^color^" ), {^f1^, ^s1^}, {^f2^, ^s2^} );
			Pen Color( "^color^" );
			Line( {^f1^, ^s1^}, {^f2^, ^s2^} );	
		)]\"	
	);

	Eval( Parse( graph_expr ) );
	
);


// Step 3: Execute the Graphics script

Report( gb1_S.2 )[Framebox( 1 )] << Add Graphics Script( Graph_Script );
1 REPLY 1
jthi
Super User

Re: Do "work" when you select an item in the Data Filter

Check out Make Filter Change Handler from Scripting Index on how to trigger action when filter selection is changed.

 

Example from scripting index:

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Cities.jmp");
dist = Distribution(Automatic Recalc(1), Continuous Distribution(Column(:POP)));
filter = dist << Local Data Filter(Add Filter(columns(:Region)));
f = Function({a}, Print(a));
rs = filter << Make Filter Change Handler(f);
-Jarmo