<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to extract a report name in a generic way using jsl in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-extract-a-report-name-in-a-generic-way-using-jsl/m-p/334403#M58214</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I modified your script a bit so that it now gets the scriptable object from OutlineBox(1) of the current report, rather than trying to use the report name (see below).&amp;nbsp; Please try it out and let me know if it works for you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
dt=Current Data Table();
rep=Current Report();

repSo=rep[OutlineBox(1)]&amp;lt;&amp;lt;Get Scriptable Object;
repscript=Char(repSO&amp;lt;&amp;lt;get script);

//data table name
dtname=dt&amp;lt;&amp;lt;Get Name();
//Report title, Scriptable Object, and finally script of report in Char form
reptitle=rep&amp;lt;&amp;lt;get window title;
substitute into(reptitle,Eval(dtname)||" - ","");

//get array of row states
rowstates=dt&amp;lt;&amp;lt;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&amp;lt;=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&amp;lt;&amp;lt;new script(reptitle,"||rowstatescript||repscript||")"));
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 17 Nov 2020 10:48:02 GMT</pubDate>
    <dc:creator>HadleyMyers</dc:creator>
    <dc:date>2020-11-17T10:48:02Z</dc:date>
    <item>
      <title>How to extract a report name in a generic way using jsl</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-extract-a-report-name-in-a-generic-way-using-jsl/m-p/334384#M58213</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;This results in an error: "Name Unresolved: rescript in access or evaluation of 'repscript', repscript/*###*/"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a solution to make this script more generic/robust, so that it would work for all types of reports?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
dt=Current Data Table();
rep=Current Report();


//data table name
dtname=dt&amp;lt;&amp;lt;Get Name();
//Report title, Scriptable Object, and finally script of report in Char form
reptitle=rep&amp;lt;&amp;lt;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)^]&amp;lt;&amp;lt;get scriptable object;")));

Try(Eval(Eval Expr(repSO=rep[Expr(report_type)]&amp;lt;&amp;lt;Get Scriptable Object));


repscript=Char(repSO&amp;lt;&amp;lt;get script));


//get array of row states
rowstates=dt&amp;lt;&amp;lt;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&amp;lt;=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&amp;lt;&amp;lt;new script(reptitle,"||rowstatescript||repscript||")"));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:22:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-extract-a-report-name-in-a-generic-way-using-jsl/m-p/334384#M58213</guid>
      <dc:creator>RobRobeyns</dc:creator>
      <dc:date>2023-06-10T23:22:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a report name in a generic way using jsl</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-extract-a-report-name-in-a-generic-way-using-jsl/m-p/334403#M58214</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I modified your script a bit so that it now gets the scriptable object from OutlineBox(1) of the current report, rather than trying to use the report name (see below).&amp;nbsp; Please try it out and let me know if it works for you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
dt=Current Data Table();
rep=Current Report();

repSo=rep[OutlineBox(1)]&amp;lt;&amp;lt;Get Scriptable Object;
repscript=Char(repSO&amp;lt;&amp;lt;get script);

//data table name
dtname=dt&amp;lt;&amp;lt;Get Name();
//Report title, Scriptable Object, and finally script of report in Char form
reptitle=rep&amp;lt;&amp;lt;get window title;
substitute into(reptitle,Eval(dtname)||" - ","");

//get array of row states
rowstates=dt&amp;lt;&amp;lt;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&amp;lt;=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&amp;lt;&amp;lt;new script(reptitle,"||rowstatescript||repscript||")"));
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 17 Nov 2020 10:48:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-extract-a-report-name-in-a-generic-way-using-jsl/m-p/334403#M58214</guid>
      <dc:creator>HadleyMyers</dc:creator>
      <dc:date>2020-11-17T10:48:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a report name in a generic way using jsl</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-extract-a-report-name-in-a-generic-way-using-jsl/m-p/334407#M58216</link>
      <description>&lt;P&gt;The issue with the JSL you have been using, is that not all window titles provide the correct information to get the Scriptable Object that can retrieve the Script.&amp;nbsp; I have found that using the initial Outline Box() from within the window is a more robust method.&amp;nbsp; However, it still will not work in all cases.&amp;nbsp; If a BY() group is specified, it will return the script for only the first BY() group.&amp;nbsp; Here is my modification to the code&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
dt=Current Data Table();
rep=Current Report();


//data table name
dtname=dt&amp;lt;&amp;lt;Get Name();
//Report title, Scriptable Object, and finally script of report in Char form
reptitle=rep&amp;lt;&amp;lt;get window title;

// The Get Scriptable Object is a message available to the Report's
// initial Outline Box

repSO = window(reptitle)[outlinebox(1)]&amp;lt;&amp;lt;get Scriptable Object;

repscript=Char(repSO&amp;lt;&amp;lt;get script);

//get array of row states
rowstates=dt&amp;lt;&amp;lt;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&amp;lt;=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&amp;lt;&amp;lt;new script(reptitle,"||rowstatescript||repscript||")"));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 17 Nov 2020 11:32:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-extract-a-report-name-in-a-generic-way-using-jsl/m-p/334407#M58216</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-11-17T11:32:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a report name in a generic way using jsl</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-extract-a-report-name-in-a-generic-way-using-jsl/m-p/334634#M58230</link>
      <description>&lt;P&gt;Thanks for the solution Jim and Hadley!&lt;/P&gt;&lt;P&gt;Much appreciated!&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2020 16:15:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-extract-a-report-name-in-a-generic-way-using-jsl/m-p/334634#M58230</guid>
      <dc:creator>RobRobeyns</dc:creator>
      <dc:date>2020-11-17T16:15:55Z</dc:date>
    </item>
  </channel>
</rss>

