Hi,
I would like to extract the report name using jsl. The script posted below is able to do so, but not for all types of reports. For example: I am able to extract the correct report name for a Graphbuilder report, but not for a Fit Manova report.
This results in an error: "Name Unresolved: rescript in access or evaluation of 'repscript', repscript/*###*/"
Is there a solution to make this script more generic/robust, so that it would work for all types of reports?
Names Default To Here(1);
dt=Current Data Table();
rep=Current Report();
//data table name
dtname=dt<<Get Name();
//Report title, Scriptable Object, and finally script of report in Char form
reptitle=rep<<get window title;
substitute into(reptitle,Eval(dtname)||" - ","");
//capture first word of reptitle
reptitlefw= word(1,reptitle," ");
report_type=reptitlefw||" ?";
//Eval(Parse(Eval Insert("repSO=rep[^(report_type)^]<<get scriptable object;")));
Try(Eval(Eval Expr(repSO=rep[Expr(report_type)]<<Get Scriptable Object));
repscript=Char(repSO<<get script));
//get array of row states
rowstates=dt<<get row states;
//script that sets row states to values in array
rowstatescript=Eval Insert(
"Names Default To Here(1);
dt=Current Data Table();
rowstates=^Char(rowstates)^;
for(i=1,i<=NRows(dt),i++,
Row State(dt,i)=As Row State(rowstates[i]);
);");
//save script for row states and report to data table
eval(parse("dt<<new script(reptitle,"||rowstatescript||repscript||")"));
Thanks!