Using JSL (xpath) to change text edit boxes within Cause and Effect DiagramsI 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></SELECT>Thanks!
GraphicsScriptingRe: Using JSL (xpath) to change text edit boxes within Cause and Effect DiagramsSince 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");
);
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 < message to the report. I am assuming that the subscript on your dgram[i] is intentional - do you have an array of Diagram objects?
Re: Using JSL (xpath) to change text edit boxes within Cause and Effect DiagramsYou 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:
