cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
StarfruitBob
Level VI

Get text from reporting platform

Hello,

 

Something I've struggled greatly with is how to Get *something* from platforms. In this case, it's the linear fit equation just under "Linear Fit". The Properties and Show Tree Structure menu both show different text exit boxes, so I've tried to grab them both and used Get (which isn't recognized by the platform, or maybe just the object), and Get text. Both do not grab the text I require. Any ideas?

 

Another issue is that 6 reports are generated, where 2 of them should be, since summarize creates a list of unique values in :sex and that's what how many times the for loop is iterating. The reporting is also filtered for these values.

Names default to here(1);
clear log();

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

summarize( gen_lst = by( dt:sex ) );

for( i = 1, i <= N Items( gen_lst ), i++,
	
	// Create visualization, save to target
	vis = eval expr( eval(
		Bivariate(
			Y( :weight ),
			X( :height ),
			Where( :sex == expr( gen_lst[i] ) )
		)
	) );

	// Fit: Linear
	vis << Fit Line( {Line Color( {255, 000, 000} )} );
	
	// Tries to copy equation in "Linear Fit"
	try( eqs_tmp1 = report(vis)["Linear Fit", TextEditBox(1)] << Get text );
	try( eqs_tmp4 = report(vis)[TextEditBox(4)] << Get text );
	try( print( eqs_tmp1 ) );
	try( print( eqs_tmp4 ) );

);

 

StarfruitBob_0-1690565105065.png

 

Learning every day!
1 ACCEPTED SOLUTION

Accepted Solutions
hogi
Level XI

Re: Get text from reporting platform

I think it should be

Eval(Eval Expr(...

Alternatively, you could use By:

Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

vis = Bivariate( Y( :weight ), X( :height ), By( :sex ) );		

vis << Fit Line( {Line Color( {255, 000, 000} )} );
(vis << XPath( "//OutlineBox[text()='Linear Fit']//TextEditBox" )) << get text;

 

 

View solution in original post

5 REPLIES 5
hogi
Level XI

Re: Get text from reporting platform

I think it should be

Eval(Eval Expr(...

Alternatively, you could use By:

Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

vis = Bivariate( Y( :weight ), X( :height ), By( :sex ) );		

vis << Fit Line( {Line Color( {255, 000, 000} )} );
(vis << XPath( "//OutlineBox[text()='Linear Fit']//TextEditBox" )) << get text;

 

 

StarfruitBob
Level VI

Re: Get text from reporting platform

Thank you for the quick reply, Hogi!

The alternate code grabs too much text for my liking, as shown in the screenshot.  I'm looking specifically to grab the equation.

 

However, thank you for catching that I flipped the eval and eval expr! That completely solved the issue! I can use either the first or second try() to get the equations I'm looking for.

 

StarfruitBob_0-1690569734740.png

 

Learning every day!
hogi
Level XI

Re: Get text from reporting platform

on my system (v17.1):

hogi_1-1690570444441.png

 

Hm, I wonder what could make the difference?

hogi
Level XI

Re: Get text from reporting platform

There are less brackets in your screenshot, right?
So, the get text is directly piped to vis and it returns the full report.

jthi
Super User

Re: Get text from reporting platform

Here are few more options which you could use. I would either use the first option here or XPath

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");

Summarize(gen_lst = by(dt:sex));

For(i = 1, i <= N Items(gen_lst), i++, 
	
	// Create visualization, save to target
	vis = Eval(Eval Expr(Bivariate(Y(:weight), X(:height), Where(:sex == Expr(gen_lst[i])))));

	// Fit: Linear
	vis << Fit Line({Line Color({255, 000, 000})});
	
	txt1 = Report(vis)[OutlineBox("Linear Fit"), Text Edit Box(1)] << get text; // I would use this or XPath
	txt2 = Report(vis)["Linear Fit", Text Edit Box(1)] << get text;
	txt3 = ((Report(vis)[OutlineBox("Linear Fit")] << Child) << child) << get text;
);

 

-Jarmo