- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
How to retrieve tabulated values by script
Dear Community,
Based on the Tabulated output below, please how can I retrieve the amounts for categories 1, 2, 3 by script?
Based on another working script I`m currently there in my tries:
r = TabulateQuantiles << report;
tb_TabQuant = r[Table Box( 1 )];
tb_TabQuant << GetText;
QuantAmount1 = tb_TabQuant[2][1];
QuantAmount2 = tb_TabQuant[2][2];
QuantAmount3 = tb_TabQuant[2][2];
Show(QuantAmount1, QuantAmount2, QuantAmount3);
But getting following error:
Cannot subscript Display Box in access or evaluation of 'r[Table Box(1)]' , r[/*###*/Table Box( 1 )]
Thanks for your help!
Senior Simulation & Planning Engineer
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to retrieve tabulated values by script
Thanks again Ian,
That is obviously the complex way, but it would be usefull in case I need to retrieve whole columns I suppose
I finally managed after finding the right syntax in the OnLine help page:
tb_TabQuant = TabulateQuantiles << MakeIntoDataTable(Invisible);
//tb_TabQuant << setName("Tabulation from "||(dt << getName));
/*
QuantAmount1 = "24636";
QuantAmount2 = "1036";
QuantAmount3 = "257";
*/
QuantAmount1 = tb_TabQuant[1,1];
QuantAmount2 = tb_TabQuant[1,2];
QuantAmount3 = tb_TabQuant[1,3];
Show(QuantAmount1, QuantAmount2, QuantAmount3);
The last blocking thing for my case wqs to convert these 3 values into stringsm which I managed using Char(number)
Cheers!
Have a great End of Year
Senior Simulation & Planning Engineer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to retrieve tabulated values by script
The best way to do something depends on what, precisely you need to do and how it fits into what you already have (and even then, 'best' is open to interpretation). But you might be able to use 'Summarize()', and dispense with 'Tabulate' altogether:
Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Big Class.jmp" );
Summarize( exg = By( :age ), exm = Mean( :height ) );
Print(exg, exm);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to retrieve tabulated values by script
This will put the values into a new table:
NamesDefaultToHere(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
tab =
dt << Tabulate(
Show Control Panel( 0 ),
Add Table(
Column Table( Grouping Columns( :age ) ),
Row Table( Analysis Columns( :height ), Statistics( Mean ) )
)
);
Wait(2);
dt2 = tab << makeIntoDataTable;
dt2 << setName("Tabulation from "||(dt << getName));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to retrieve tabulated values by script
Thanks a lot Ian,
The Tabulate Analysis does not behave like others thenm simply using [Table Box( i )] ...
Sorry, but i`m now struggling with retrieving the data from the data tablem and could not find it in the Scripting index:
Senior Simulation & Planning Engineer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to retrieve tabulated values by script
Yes, if you can avoid plucking values from the display tree that's usually a good strategy. If you want to get the values into variables, you can do something like this ('levels' will be a list, 'vals' a matrix):
NamesDefaultToHere(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
tab =
dt << Tabulate(
Show Control Panel( 0 ),
Add Table(
Column Table( Grouping Columns( :age ) ),
Row Table( Analysis Columns( :height ), Statistics( Mean ) )
)
);
dt2 = tab << makeIntoDataTable;
dt2 << setName("Tabulation from "||(dt << getName));
cols = dt2 << getColumnNames(:String);
RemoveFrom(cols, 1, 2);
dt3 = dt2 <<
Transpose(
columns(Eval(cols)),
Transpose selected rows only( 1 ),
Label( :Statistics ),
Output Table( (dt2 << getName) )
);
levels = Column(dt3, "Label") << getValues;
vals = Column(dt3, "Mean") << getValues;
Close(dt2, NoSave);
Close(dt3, NoSave);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to retrieve tabulated values by script
Thanks again Ian,
That is obviously the complex way, but it would be usefull in case I need to retrieve whole columns I suppose
I finally managed after finding the right syntax in the OnLine help page:
tb_TabQuant = TabulateQuantiles << MakeIntoDataTable(Invisible);
//tb_TabQuant << setName("Tabulation from "||(dt << getName));
/*
QuantAmount1 = "24636";
QuantAmount2 = "1036";
QuantAmount3 = "257";
*/
QuantAmount1 = tb_TabQuant[1,1];
QuantAmount2 = tb_TabQuant[1,2];
QuantAmount3 = tb_TabQuant[1,3];
Show(QuantAmount1, QuantAmount2, QuantAmount3);
The last blocking thing for my case wqs to convert these 3 values into stringsm which I managed using Char(number)
Cheers!
Have a great End of Year
Senior Simulation & Planning Engineer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to retrieve tabulated values by script
The best way to do something depends on what, precisely you need to do and how it fits into what you already have (and even then, 'best' is open to interpretation). But you might be able to use 'Summarize()', and dispense with 'Tabulate' altogether:
Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Big Class.jmp" );
Summarize( exg = By( :age ), exm = Mean( :height ) );
Print(exg, exm);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to retrieve tabulated values by script
Would indeed make my life easier for this specific purpose!
Senior Simulation & Planning Engineer