Re: Is it possible to dynamically update "graph title" based item selection in local data filter (including multiple selections)?The approach you can take is to add to the Local Data Filter, a Change Handler (Make Filter Change Handler), that when the filter changes, it captures the Where Clause(Get where clause) and then takes that result and applies it to the Title in the Graph's title(set text).
The documentation on how to manipulate the output can be found in the Scripting Guide section on Display Trees. This documentation is available in the JMP Documentation Library, available under the Help pull down menu.
Re: Is it possible to dynamically update "graph title" based item selection in local data filter (including multiple selections)?@hogi Thanks. This will work but I have more than one data filters panel and I want to have the title changed based on only one of them (You script appears to capture all changes in any of the local data filter panels).
How to capture changes in a specific local data filter panel?
Re: Is it possible to dynamically update "graph title" based item selection in local data filter (including multiple selections)?If there are several data filters in the same report, to get the correct one, you could start from the respective GaphBuilder object, go one step up and search for the Data Filter:
ldf = (gb << parent)["Local Data Filter"] << get scriptable object;
full code:
View more...
Alternatives which are less robust:
ldf = (current report() << XPath("(//OutlineBox[text()='Local Data Filter'])"))[2] << get scriptable object;
ldf = current report()[OutlineBox(3)]<< get scriptable object;
Re: Is it possible to dynamically update "graph title" based item selection in local data filter (including multiple selections)?@hogi Thanks for your suggestions. I tried your second less robust option but I can see that it is not very robust as you say and I could not get it to work properly.
In the following script, if I want to show only the "age" selection on the chart tile, how to script it?
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
Graph Builder(
Size( 570, 518 ),
Show Control Panel( 0 ),
Variables( X( :height ), Y( :weight ), Overlay( :sex ) ),
Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 2 ) ) ),
Local Data Filter(
Conditional,
Add Filter(
columns( :sex, :age, :weight ),
Display( :sex, "Check Box Display" ),
Display( :age, "Check Box Display" )
)
),
SendToReport( Dispatch( {}, "graph title", TextEditBox, {Set Text( "" )} ) )
);
Re: Is it possible to dynamically update "graph title" based item selection in local data filter (including multiple selections)?Sorry, for the misunderstanding.
If there is just a single Data Filter in the report, there is no need to specify the reference more precisely.
On the other hand:
If you want to restrict the title to some part of the Where Clause, you need another Regex expression like the one below.
It searches for any :age == within round brackets and returns the whole string within the brackets.
So, For cases like
"Select Where( (:age == 14 | :age == 15) & :weight >= 113.5 )";
"Select Where( :age == 14 | :age == 16 | :age == 17 )"
it will just return the :age ... part.
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
gb = Graph Builder(
Size( 570, 518 ),
Show Control Panel( 0 ),
Variables( X( :height ), Y( :weight ), Overlay( :sex ) ),
Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 2 ) ) ),
Local Data Filter(
Conditional,
Add Filter(
columns( :sex, :age, :weight ),
Display( :sex, "Check Box Display" ),
Display( :age, "Check Box Display" )
)
),
SendToReport( Dispatch( {}, "graph title", TextEditBox, {Set Text( "" )} ) )
);
ldf = Current Report()["Local Data Filter"] << get scriptable object;
changeTitle = Function( {this},
print(this);
ldfText = Regex(ldf << get where clause(),".*\((:age == .*?)\).*","\1");
(Report( gb ) << XPath( "//TextEditBox" ))[1] << Set Text( ldfText );
);
fsh = ldf << Make Filter Change Handler(
changeTitle();
);Re: Is it possible to dynamically update "graph title" based item selection in local data filter (including multiple selections)?@hogi . Your script below does not show or change the chart title for me in JMP 16.2.0.
ames Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
gb = Graph Builder(
Size( 570, 518 ),
Show Control Panel( 0 ),
Variables( X( :height ), Y( :weight ), Overlay( :sex ) ),
Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 2 ) ) ),
Local Data Filter(
Conditional,
Add Filter(
columns( :sex, :age, :weight ),
Display( :sex, "Check Box Display" ),
Display( :age, "Check Box Display" )
)
),
SendToReport( Dispatch( {}, "graph title", TextEditBox, {Set Text( "" )} ) )
);
ldf = Current Report()["Local Data Filter"] << get scriptable object;
changeTitle = Function( {this},
print(this);
ldfText = Regex(ldf << get where clause(),".*\((:age == .*?)\).*","\1");
(Report( gb ) << XPath( "//TextEditBox" ))[1] << Set Text( ldfText );
);
fsh = ldf << Make Filter Change Handler(
changeTitle();
);
Is it possible to dynamically update "graph title" based item selection in local data filter (including multiple selections)?I use the following to display "my text" at the top of my charts.
Dispatch( {}, "graph title", TextEditBox, {Set Text( "my text" )} )However, I would like to have the item(s) selected in the local data filter to be displayed in the graph title as I select them (perhaps multiple sections as comma delimited?).
How to achieve this in JSL?
Mass CustomizationRe: Is it possible to dynamically update "graph title" based item selection in local data filter (including multiple selections)?Nice regex!
The parentheses are being used in two clever ways:
Regex(ldf << get where clause(),"\( *(:age == .*?)\)","\1");
At the beginning and end of the pattern, the backslash character is escaping a parenthesis, \(...\) so it matches a literal parenthesis in the where clause. The space followed by asterisk matches zero or more spaces.
The inner pair of parentheses look like they would be matching the actual parentheses in the where clause, but no! The actual parentheses were already matched. These inner parentheses are grouping parentheses, and they form the first group in the match.
Within the grouping parentheses, the literal characters :age == are matched, then .*? matches characters, one at a time, until that final, escaped, literal parenthesis can be matched. The . matches anything, the * means 0 or more, and the ? changes the 0 or more from greedy (race to the end) to reluctant (one at a time). The reluctant behavior makes sure the first parenthesis is used.
Finally, the "\1" is used to format a result: everything the first set of grouping parentheses matched.
Re: Is it possible to dynamically update "graph title" based item selection in local data filter (including multiple selections)?@hogi Your script below now works in JMP 16.2 but with the following issues.
- The chart starts with no age selected and no title shown but the last one remains shown on the chart title when all age checkboxes are unchecked.
- In the actual problem, the title starts showing only when more than one check boxes are checked.
How to resolve these two issues (unless this is my JMP version specific) ?
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
gb = Graph Builder(
Size( 570, 518 ),
Show Control Panel( 0 ),
Variables( X( :height ), Y( :weight ), Overlay( :sex ) ),
Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 2 ) ) ),
Local Data Filter(
Conditional,
Add Filter(
columns( :sex, :age, :weight ),
Display( :sex, "Check Box Display" ),
Display( :age, "Check Box Display" )
)
),
SendToReport( Dispatch( {}, "graph title", TextEditBox, {Set Text( "" )} ) )
);
ldf = Current Report()["Local Data Filter"] << get scriptable object;
changeTitle = Function( {this},
print(this);
ldfText = Regex(ldf << get where clause(),"\( *(:age == .*?)\)","\1");
(Report( gb ) << XPath( "//TextEditBox" ))[1] << Set Text( ldfText );
);
fsh = ldf << Make Filter Change Handler(
changeTitle();
);Re: Is it possible to dynamically update "graph title" based item selection in local data filter (including multiple selections)?You are right.
If Regex doesn't find the age info, it returns missing.
So, after
ldfText = Regex(ldf << get where clause(),"\( *(:age == .*?)\)","\1");
please add
if(ismissing(ldfText),ldfText = "all ages");
to fix the issue.
Re: Is it possible to dynamically update "graph title" based item selection in local data filter (including multiple selections)?If you just select one entry at a time, you could use the page dropzone to automatically label the plot:
[if multiple entries are selected, the respective data gets split across multiple pages]

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
Graph Builder(
Variables( X( :height ), Y( :weight ), Page( :age ), Overlay( :sex ) ),
Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 2 ) ) ),
Local Data Filter(
Add Filter(
columns( :sex, :age, :weight ),
Where( :age == 14 )
)
)
);Re: Is it possible to dynamically update "graph title" based item selection in local data filter (including multiple selections)?My script below (for the actual case) appears to be triggering only after the second check box selection. Any leads as to why would be useful.
changeTitle = Function( {this},
print(this);
ldfText = Regex(ldf << get where clause(),"\( *(:Parameter == .*?)\)","\1");
if(ismissing(ldfText),ldfText = " Selected Test Parameter ");
(Report( gb ) << XPath( "//TextEditBox" ))[4] << Set Text(ldfText);
);
fsh = ldf << Make Filter Change Handler(
changeTitle();
);Re: Is it possible to dynamically update "graph title" based item selection in local data filter (including multiple selections)?Oh, sorry, I always started by selecting the age - and then I missed that the title didn't update for the case of one age selection + something else.
If there is just a single age selection, there is no need for additional brackets.
So, how about skipping the first bracket ?
NB: please don't use inverse with this version 

changeTitle = Function( {this},
print(this);
print(ldf << get where clause());
ldfText = Regex(ldf << get where clause(),"(:age == .*?)\)","\1");
if(ismissing(ldfText),ldfText = "any text you want");
(Report( gb ) << XPath( "//TextEditBox" ))[1] << Set Text( ldfText );
);Re: Is it possible to dynamically update "graph title" based item selection in local data filter (including multiple selections)?@hogi . Does not work for me in JMP 16.2.0. I have opened a new thread on this with a better example on what is not working here (link).
Re: Is it possible to dynamically update "graph title" based item selection in local data filter (including multiple selections)?Actually, this version should with Jmp 16.2.0:
Re: Is it possible to dynamically update "graph title" based item selection in local data filter (including multiple selections)?Ok thank you it works correctly, but if ever how can we put just the first name last name that it finds in the database?
In your example this would display only the first name âKATIEâ
Re: Is it possible to dynamically update "graph title" based item selection in local data filter (including multiple selections)?like this it works correctly:
changeTitle = Function( {this},
Eval( Parse( "theRows = dt << get rows where" || Substr( ldf << get where clause(), 13 ) ) );
If( Length( theRows ) > 0,
theRow = theRows[1];
ldfText = :remarques[theRow],
ldfText = "All Names"
);
(Report( gb ) << XPath( "//TextEditBox" ))[1] << Set Text( ldfText );
);