Subscribe Bookmark RSS Feed

Problem with Get as Table from Report

Buzuddha

Occasional Contributor

Joined:

Feb 2, 2017

Hello all,

 

Im trying to extract information from a TableBox() in a report into a data table for manipulation. I've read through http://www.jmp.com/support/help/Manipulating_Displays.shtml#196022 and have some of it working, but I have two problems:

 

var = rdist["Summary Statistics"][1][1][1][1];

 

returns

"mean"

 

So I know I've can Identify the object and use the syntax, but 

 

 

var = rdist["Summary Statistics"][1][TableBox(4)][1][1];

 

returns 

 

Cannot subscript Display Box in access or evaluation of 'Subscript' , rdist["Summary Statistics"][1][/*###*/Table Box( 4 )]

In the following script, error marked by /*###*/
var = rdist["Summary Statistics"][1][/*###*/Table Box( 4 )][1][1]

 

Perhaps I'm missing something obvious. A picture of the display tree is attatched. Don't know why it won't accept the syntax.

 

The real goal is to get the table I want to use is the "Summary Statistics" tablebox(4). 

 

So when I try:

var = rdist["Summary Statistics"][1][1];
rdist << make data table();

I get:

The display box 'OutlineBox' does not recognize the message 'make data table'; perhaps you mean one of these:  <<Make RowState Handler <<Selectable <<Get Title <<Set Title <<Set Menu Item State <<Get Menu Item State <<Set Scriptable Object <<Get Scriptable Object <<Add Text Item <<Set Font Name <<Get Font Name <<Set Window Title <<Add Pin Annotation <<Save Capture <<Get Window Title <<Set Window Title <<SetNotStretchable.

Screen Shot 2017-02-02 at 8.53.14 AM.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
markbailey

Staff

Joined:

Jun 23, 2011

Solution

The index shown in the display tree diagram is an absolute reference. The [5] is absolute. Later you subscript down to the single local table box, so it is now [1].

I suggest using the closest unique reference, such as the outline box "Tests Between Groups" and then TableBox(1).

Learn it once, use it forever!
8 REPLIES
txnelson

Super User

Joined:

Jun 22, 2012

This is the method that I use to approach the problem

 

names default to here(1);
dt=open("$SAMPLE_DATA/semiconductor capability.jmp");
dis=Distribution(
	Continuous Distribution( Column( :NPN1 ) ),
	Continuous Distribution( Column( :PNP1 ) )
);
n items(report(dis));

mean=(report(dis)["NPN1"]["Summary Statistics"][1][1][2]<<get)[1];
Jim
Buzuddha

Occasional Contributor

Joined:

Feb 2, 2017

Thanks for your reply Jim. This isn't exactly what I mean to do.

 

Ultimately, I'd need the script to go through the iterations ("By" variable) for a given report and extract the TableBox(4) into a data table then concatenate all of those with identifiers or which iteration of the analysis it came from.

 

I think I can figure out the concatenations and so on, it's just extracting the TableBox(4), in this example, as a data table. According to the article in the JMP Scripting>Display Trees>Manipulating Displays, this should be possible.

 

Their example is:

rbiv[tablebox(4)] << make data table("ANOVA table");

So I know the send command can do make data table. I just don't get why in my case I get the error message given that I can apropriately identify data within the table.

txnelson

Super User

Joined:

Jun 22, 2012

change the "Make Data Table" to "Make Combined Data Table" and I think you will get what you want.  It will put into one data table, all of the data from each of the Tableboxes

Jim
Buzuddha

Occasional Contributor

Joined:

Feb 2, 2017

Ok, I realized I was sending the wrong variable to "make data table()". So that's good. But the thing I don't get is:

 

sr = surv << Report;
var = sr[1][1][1]["Tests Between Groups"][1];
var<< make data table();

Makes a nice data table with the stats I want. But....

var = sr[1][1][1]["Tests Between Groups"][TableBox(5)];

Returns:

Cannot subscript Display Box in access or evaluation of 'Subscript' , sr[1][1][1]["Tests Between Groups"][/*###*/Table Box( 5 )]

In the following script, error marked by /*###*/
var = sr[1][1][1]["Tests Between Groups"][/*###*/Table Box( 5 )]

So what I would like to know is why:

 

"var = sr[1][1][1]["Tests Between Groups"][TableBox(5)];" ------- is not the same as -------- "var = sr[1][1][1]["Tests Between Groups"][1];"

 

Is there some syntax that I'm missing?

 

markbailey

Staff

Joined:

Jun 23, 2011

Solution

The index shown in the display tree diagram is an absolute reference. The [5] is absolute. Later you subscript down to the single local table box, so it is now [1].

I suggest using the closest unique reference, such as the outline box "Tests Between Groups" and then TableBox(1).

Learn it once, use it forever!
Buzuddha

Occasional Contributor

Joined:

Feb 2, 2017

That works. Thanks for clarifying!

 

I would say this is a little bit tricky because that TableBox is listed with a different number in the parentheses "TableBox(1)" in the JMP script is the first TableBox after the OutlineBox labelled "Tests Between Groups", rather than "TableBox(4)" which is how it appears in the display tree. 

 

A feature I would love to see in JMP would be the ability to drag a feature from the display tree or even a report into the script window and have the display tree reference appear in the script editor.

 

Anyhow, I love JMP and the << make combined data table() command is a life saver! Thanks for writing it!

markbailey

Staff

Joined:

Jun 23, 2011

That is a good idea.

It isn't that tricky. You just have to understand that you can use absolute or relative references. The display tree diagram is a big aid but we do not recommend using absolute references. That index will change if something appears or disappears between the root of the display tree and the target display box. On the other hand, the relative refernce almost never breaks. So in your example the sr["Tests Between Groups"][TableBox(1)] is the most direct and reliable reference. The first subscript gets to the target outline box and then the next subscript (they are nested) gets you the target. You really don't need all the [1] subscripts in your initial example. In fact, that makes the reference fragile for the reason I mentioned at the start of this post.

Learn it once, use it forever!
Buzuddha

Occasional Contributor

Joined:

Feb 2, 2017

Thanks!