Subscribe Bookmark RSS Feed

Iterating through mulitple outline boxes in a report via jsl

tomlight

Community Trekker

Joined:

Mar 2, 2016

Hi all,

I've searched through Scripting Guide and the Scripting Index, but can't find a way to do what I want to do.

Here's the task:

  1. I am writing a script that runs many other pre-existing scripts one-at-a-time. Needed aspects of each pre-existing script's report are taken and copied into a "Full Report" master window.
    1. Due to trust concerns, I am not allowed to alter any pre-existing scripts
  2. If I only need to take the full report from a script wholesale, this is very easy and can be accomplished by:

[create master window for full report]

::winOut = New Window( "FullReport_" || Substitute( Abbrev Date( Today() ), "/", "-" ),

::vListOut = V List Box()

);

::dtMain = Current Data Table();

::dtMain << Clear Select;

[easy append example]

::boxTemp = Outline Box( "** Variablity Charts for All Weeks" );

::boxTemp << Append( (::dtMain << Run Script( "VarChart" )) << Report );

::vListOut << Append( ::boxTemp );


Here's the problem:

  1. Sometimes I need to close certain outline boxes within a report via JSL
  2. Step 1 is easy if the report has a single "main box" that contains all of the outline boxes that need to be closed, but this isn't always the case.
  3. For example, there is a script that produces a fit model. For this fit model, the "By:" function is used, which creates 3 separate "main boxes" that are entitled "Response Log(Production) Condition = A", "Response Log(Production) Condition = B", and "Response Log(Production) Condition = C".
  4. So what I need is code to either do:
    1. "Close any outline box within this report that is titled 'Effect Summary'"
      1. something similar to (this doesn't work): ::repCurrent[Outline Box("Effect Summary")]<<Close(1);
    2. "For each outline box in this report, check its name. If its name contains "Effect Summary", then close it.

And, as a second problem, could someone please explain the following behavior?

  1. Code such as ::boxTemp << Append( (::dtMain << Run Script( "VarChart" )) << Report ); does not always work when the report generated by a script does more than simply create a report (i.e., it makes a report, modifies the data table, and then reformats the report)
  2. When this occurs, I need to use:

::dtMain << RunScript( "Distributions" );

::repCurrent = Current Report();

::boxTemp << Append( ::repCurrent[Outline Box( "Distributions" )] );

Special note "::boxTemp<<Append(::repCurrent);" does not work at all for some reason

Does anyone know why I need to use "Current Report"?

For my first problem, there will be multiple outline boxes within the report that need to be copied over, so it's not going to be as straight-forward as the example above. Is there anyway to take a save report object that was initialized via "Current Report()" and use the "Append" function on that report object without having to specify an object (i.e., how do I tell it to append the ENTIRE report object's contents, and not the specific contents of an outline box contained within a report).

1 REPLY
ian_jmp

Staff

Joined:

Jun 23, 2011

You may find something that will help with your (first) problem at https://community.jmp.com/message/225609#225609.