cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Learn how to build custom Python data connectors and further customize JMP’s Data Connector Framework with the Python Data Connector Demo, available now in the JMP Marketplace!
  • See how to create experiments to support product design and ID useful product features. Register for June 12 webinar, 2pm US Eastern Time.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
mtowle419
Level II

Dynamic updates to GB via AddGraphicsScript and Eval/Expr - throwing "Name Unresolved"

namesdefaulttohere(1);
try(nw3<<close window);

toggle = expr(
	x = random integer(10,90);
	y = random integer(10,90);
	
	foreach({key}, map,
		gb = map[key];
		f = gb[framebox(1)];
		f << add graphics script(
			eval(expr( text({x,y}, key) ))
		)
	)
);

vlb = vlistbox();
map = [=>];

foreach({alpha}, words("a b c"),
	map[alpha] = graphbox(suppress axes, frame size(100,100));
	vlb<<append( map[alpha] )
);

nw3 = new window("ex",outlinebox("what",
	{"toggggggle", toggle},
	vlb
))

Error:

Name Unresolved: key in access or evaluation of 'key' , key/*###*/

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
mtowle419
Level II

Re: Dynamic updates to GB via AddGraphicsScript and Eval/Expr - throwing "Name Unresolved"

 

Figured it out. Rather than reach for the value of `key` at eval time, we can save it when initializing the GB. Here, we're calling it `beta`, but key/beta are just references to one of words("a b c")

 

toggle = expr(
	x = random integer(10,90);
	y = random integer(10,90);
	
	foreach({key}, map,
		gb = map[key];
		f = gb[framebox(1)];
		f << add graphics script(
			eval(eval expr( text({x,y}, expr(beta)) )) // change #1
		)
	)
);


vlb = vlistbox();
map = [=>];

foreach({alpha}, words("a b c"),
	map[alpha] = eval(eval expr(graphbox(suppress axes, frame size(100,100),

		beta = expr(alpha); // change #2 (plus wrapping GB in eval/eval expr
		
	)));
	vlb<<append( map[alpha] )
);

nw3 = new window("ex",outlinebox("what",
	{"toggggggle", toggle, "toggle2", toggle2},
	vlb
))

 

 

View solution in original post

1 REPLY 1
mtowle419
Level II

Re: Dynamic updates to GB via AddGraphicsScript and Eval/Expr - throwing "Name Unresolved"

 

Figured it out. Rather than reach for the value of `key` at eval time, we can save it when initializing the GB. Here, we're calling it `beta`, but key/beta are just references to one of words("a b c")

 

toggle = expr(
	x = random integer(10,90);
	y = random integer(10,90);
	
	foreach({key}, map,
		gb = map[key];
		f = gb[framebox(1)];
		f << add graphics script(
			eval(eval expr( text({x,y}, expr(beta)) )) // change #1
		)
	)
);


vlb = vlistbox();
map = [=>];

foreach({alpha}, words("a b c"),
	map[alpha] = eval(eval expr(graphbox(suppress axes, frame size(100,100),

		beta = expr(alpha); // change #2 (plus wrapping GB in eval/eval expr
		
	)));
	vlb<<append( map[alpha] )
);

nw3 = new window("ex",outlinebox("what",
	{"toggggggle", toggle, "toggle2", toggle2},
	vlb
))

 

 

Recommended Articles