Choose Language Hide Translation Bar
Highlighted
Bill_Even
Level II

Creating a Handle for a Graph Builder Window created from an Expression

I can easily create a handle for a Graph Builder window so that I can create the report layer:

 

 

myGraph = dt << Graph Builder(yada, yada, yada);
myRep = myGraph << Report;

 

 

Let's say that I want to modify an argument in Graph Builder before creating the graph:

 

 

myExpr = expr(Graph Builder(yada, yada, yada);
// Use remove from and insert into to modify myExpr
myExpr1 = expr(myGraph = dtIn << expr(myExpr));
eval expr(myExpr1);

 

When I use the above commands, the graph gets created, but it does not appear that myGraph is a proper handle, so I can't create a report layer with

 

myRep = myGraph << Report;

 

How would I manipulate myExpr to create a handle when the graph is created?

 

I have a hack work around whuch I reallly don't like:

 

myList = window() << get window title;
// search myList for the number of items that contain the "Graph Builder" string (call this n)
myRep = Graph Builder[n] << Report;

 

Thanks,

Bill

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: Creating a Handle for a Graph Builder Window created from an Expression

Here is an example that might be adapted to your purpose. It follows your original pattern of launching Graph Builder and then getting the reference to the report layer.

 

Names Default to Here( 1 );

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

gb expr = Expr(
	gb = dt << Graph Builder(
		Size( 534, 452 ),
		Show Control Panel( 0 ),
		Show Legend( 0 ),
		Variables( X( xxx ), Y( yyy ) ),
		Elements( Points( X, Y, Legend( 3 ) ), Smoother( X, Y, Legend( 4 ) ) )
	);
);

Eval(
	Substitute(
		Name Expr( gb expr ),
		Expr( yyy ), Expr( dt:weight ),
		Expr( xxx ), Expr( dt:height )
	)
);

gb rep = gb << Report;
Learn it once, use it forever!

View solution in original post

2 REPLIES 2
Highlighted

Re: Creating a Handle for a Graph Builder Window created from an Expression

Here is an example that might be adapted to your purpose. It follows your original pattern of launching Graph Builder and then getting the reference to the report layer.

 

Names Default to Here( 1 );

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

gb expr = Expr(
	gb = dt << Graph Builder(
		Size( 534, 452 ),
		Show Control Panel( 0 ),
		Show Legend( 0 ),
		Variables( X( xxx ), Y( yyy ) ),
		Elements( Points( X, Y, Legend( 3 ) ), Smoother( X, Y, Legend( 4 ) ) )
	);
);

Eval(
	Substitute(
		Name Expr( gb expr ),
		Expr( yyy ), Expr( dt:weight ),
		Expr( xxx ), Expr( dt:height )
	)
);

gb rep = gb << Report;
Learn it once, use it forever!

View solution in original post

Highlighted
Bill_Even
Level II

Re: Creating a Handle for a Graph Builder Window created from an Expression

Thank you very much Mark!!

Your explanation showed me how to do the substitution and evaluation in a single step. 

 

Regards,

Bill

 

 

 

Article Labels

    There are no labels assigned to this post.