Subscribe Bookmark RSS Feed

Newbie Question extracting values from a report

Hegedus

Community Trekker

Joined:

Jun 23, 2011

Hi,

I am trying to come up to speed on extracting values from a report called by a script.

To test things out I create two simple columns and do a fit and I am trying to extract the intercept from the estimate just so I know what I am doing.

Test=Bivariate(

  Y( :Column 2 ),

  X( :Column 1 ),

  Fit Line( {Line Color( {208, 64, 86} )} )

);

r=test<<report;

fred=r[outlinebox("Linear Fit"),Outlinebox("Parameter Estimates"),ColBox("Estimate")[1]]<<get(1);

show(fred);


I am trying (obviously unsuccessfully) to follow the example in the manual and I am getting an error as show in the log window

index{100} in access or evaluation of 'Get' , Get( 1 ) /*###*/



What should this test script look like?


3 REPLIES
chris_kirchberg

Joined:

May 28, 2014

Hi,

There is a little syntax error in this section of the code:

fred=r[outlinebox("Linear Fit"),Outlinebox("Parameter Estimates"),ColBox("Estimate")[1]]<<get(1);

The column box reference is a number column box in the report, so try using NumberColBox. Also, Put the reference of the first value inside the () instead of outside and remove the [ ]. Put a comma between the title and the number reference. See below

fred=r[OutlineBox("Linear Fit"),OutlineBox("Parameter Estimates"),NumberColBox("Estimate",1)]<<get(1);

That should work for you.

Best Regards,

Chris Kirchberg

Hegedus

Community Trekker

Joined:

Jun 23, 2011

I was fishing through the scripting manual and in the section on invisible reports (pg 384 on manual for Version 12)yields a different syntax that eschews the get directive completely and uses a term columnbox which does not appear to be a reserved word because it is not showing up in blue font color.  This also works.  If I use the properties window to examine the report, The "estimate" is listed as a "col box"

Test=Bivariate(

  Y( :Column 2 ),

  X( :Column 1 ),

  Fit Line( {Line Color( {208, 64, 86} )} )

);

r=test<<report;

//fred=r[Col Box("Estimate")][2];

fred=r[outlinebox("Linear Fit"),Outlinebox("Parameter Estimates"),ColumnBox("Estimate")][1];

show(fred);

8489_Untitled.png

chris_kirchberg

Joined:

May 28, 2014

Yup, that will work as long as you don't use the Get Message.