cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
Raybob
Level II

Using JSL (xpath) to change text edit boxes within Cause and Effect Diagrams

I am trying to color the text edit boxes within my cause and effect diagram, but when I use the xpath function to grab a specific box, it always selects the whole diagram. Is there a more specific route to get the individual text edit boxes?

 

((dgram)[i])<< (xpath("//texteditbox")[i])<<select();

Thanks!

2 ACCEPTED SOLUTIONS

Accepted Solutions

Re: Using JSL (xpath) to change text edit boxes within Cause and Effect Diagrams

 

I think the main issue with your existing script is that the second [i] subscript should be outside of the parentheses:

dt = Open( "$SAMPLE_DATA/Ishikawa.jmp" );
obj = dt << Diagram( Y( :Child ), X( :Parent ) );
(obj << XPath("(//TextEditBox)"))[9] << Text Color("Red");

With a constant, you *can* put the subscript directly in the XPath expression:

 

 

dt = Open( "$SAMPLE_DATA/Ishikawa.jmp" );
obj = dt << Diagram( Y( :Child ), X( :Parent ) );
(obj << XPath("(//TextEditBox)[9]")) << Text Color("Red");

But in your case, it is really sending a <<Subscript(XPath(),i) message to the report.  I am assuming that the subscript on your dgram[i] is intentional - do you have an array of Diagram objects?

 

View solution in original post

vince_faller
Super User (Alumni)

Re: Using JSL (xpath) to change text edit boxes within Cause and Effect Diagrams

Since you're doing // instead of /. You're telling Xpath that you want ALL text edit boxes at any level.  You'd have to put filters on which text edit boxes you want.  

 

For instance, here's one based off of the name that's in the text.  

 

Names default to here(1);
dt = Open( "$SAMPLE_DATA/Ishikawa.jmp" );
obj = dt << Diagram( Y( :Child ), X( :Parent ) );
some_text = {"Time", "Splatter"};
for(i=1, i<=nitems(some_text), i++, 
	this_text = some_text[i];
	xp = "//TextEditBox[text() = '"||this_text||"']";
	(obj << XPath(xp)) << Text Color("Red");
);
Vince Faller - Predictum

View solution in original post

3 REPLIES 3

Re: Using JSL (xpath) to change text edit boxes within Cause and Effect Diagrams

You might explore the properties that are available for these text edit boxes. You can quickly, interactively explore them by right-clicking on the reveal button to the left of the outline box:

 

prop.PNG

Re: Using JSL (xpath) to change text edit boxes within Cause and Effect Diagrams

 

I think the main issue with your existing script is that the second [i] subscript should be outside of the parentheses:

dt = Open( "$SAMPLE_DATA/Ishikawa.jmp" );
obj = dt << Diagram( Y( :Child ), X( :Parent ) );
(obj << XPath("(//TextEditBox)"))[9] << Text Color("Red");

With a constant, you *can* put the subscript directly in the XPath expression:

 

 

dt = Open( "$SAMPLE_DATA/Ishikawa.jmp" );
obj = dt << Diagram( Y( :Child ), X( :Parent ) );
(obj << XPath("(//TextEditBox)[9]")) << Text Color("Red");

But in your case, it is really sending a <<Subscript(XPath(),i) message to the report.  I am assuming that the subscript on your dgram[i] is intentional - do you have an array of Diagram objects?

 

vince_faller
Super User (Alumni)

Re: Using JSL (xpath) to change text edit boxes within Cause and Effect Diagrams

Since you're doing // instead of /. You're telling Xpath that you want ALL text edit boxes at any level.  You'd have to put filters on which text edit boxes you want.  

 

For instance, here's one based off of the name that's in the text.  

 

Names default to here(1);
dt = Open( "$SAMPLE_DATA/Ishikawa.jmp" );
obj = dt << Diagram( Y( :Child ), X( :Parent ) );
some_text = {"Time", "Splatter"};
for(i=1, i<=nitems(some_text), i++, 
	this_text = some_text[i];
	xp = "//TextEditBox[text() = '"||this_text||"']";
	(obj << XPath(xp)) << Text Color("Red");
);
Vince Faller - Predictum