@jthi In the example cases so far everything works as expected and matches what you see.
However, I was able to reproduce part of the issue I am facing with my actual data by creating another data table which more closely matches with my actual data. Data table is attached and using the script below
Names Default To Here(1);
dt = Current Data Table();
gb = dt << Graph Builder(
Size( 571, 174 ),
Show Control Panel(0),
Variables(X(:PartID), Y(:Median), Page(:Parameter), Color(:TestStage)),
Elements(Points(X, Y, Legend(34))),
Local Data Filter(
Conditional,
Add Filter(
columns(:TestDate, :Has Limits?, :TestStage, :Parameter ),
Where( :Has Limits? == "Yes" ),
Where( :TestStage == "STG5" ),
)
),
SendToReport(Dispatch({}, "graph title", TextEditBox, {Set Text("myTitleGoesHere")}))
);
Summarize(dt, uniq_params = By(:Parameter));
update_title = Function({this},
param_where = Regex(local_filter << get where clause(), "\(?\s*(:Parameter == .*?)\)", "\1");
If(Is Missing(param_where),
param_list = uniq_params,
param_where_list = Words(param_where, "|");
param_list = Transform Each({where_str}, param_where_list,
title = Trim Whitespace(Word(-1, where_str, "="));
Substitute(title, "\!"", "");
);
);
tebs = Report(gb) << XPath("//GraphBuilderTitleBox/TextEditBox");
y_tebs = tebs[4 :: N Items(tebs) :: 2]; // skip title, subtitle and xaxis?
If(N Items(y_tebs) != N Items(param_list),
Return(0); // some problem
);
gb << inval;
For Each({param_val, idx}, param_list, y_tebs[idx] << Set Text(param_val));
gb << update window;
Return(1);
);
local_filter = Current Report()["Local Data Filter"] << get scriptable object;
update_title(local_filter);
filter_handler = local_filter << Make Filter Change Handler(update_title());
I get the following when no Parameters are selected,
and this one after selecting all Parameters and unselecting them again. Here the top chart only gets the correct y-axis label.
Hopefully if these get resolved, my actual data case will start working as expected as well. Any direction would be very useful.
When it's too good to be true, it's neither