Our World Statistics Day conversations have been a great reminder of how much statistics can inform our lives. Do you have an example of how statistics has made a difference in your life? Share your story with the Community!
Choose Language Hide Translation Bar
Highlighted
tsolomon
Level III

Evaluating an expression with where function and displaying output

Hi, I am making a series of graphs from a data table which are separated based off variable names in another table. Basically when I make a bivariate graph of y vs x, the by is selected from another table of names. I put the graphs in a lineup box but I can not get the where to use the actual values which the variables represent. In addition, a separate text box appears above the graphs with the where designated instead of displaying in the graph title. Basically, I see Where(:Parameter == CofA_dt10:Parameter[w]) but I would like to see the expression evaluated for the different values of w so we know which variable the graph represents. I have tried multiple variations of eval, eval expr and parse and can not get the test to display the way I want. My code is below, any suggestions would be greatly appreciated. It doesnt display with the EVAL function included as below, if I delete the EVAL function, the window will display but with the problem described above.

 

CofA_dt10 = Data Table( "GraphData" ) << Summary(
Group( :Parameter ),
Freq( "None" ),
Weight( "None" )
);
output2 = lineup box(Ncol(1));
 
 
row_count = nrow(CofA_dt10);
 
 
for(w=1, w<=row_count-1, w++,
 
 
output2 << append (CofA_dt9 << Bivariate(
Y( :test_value ),
X( :received_date ),
Where( :Parameter == Eval(CofA_dt10:Parameter[w])),
 
SendToReport(
Dispatch(
{},
"Bivariate Fit of CofA Parameter Value By received_date",
OutlineBox,
{Set Title( "CofA Material Parameter Value By received_date" )}
),
Dispatch( {}, "1", ScaleBox, {Label Row( Label Orientation( "Angled" ) )} ),
Dispatch( {}, "test_value", TextEditBox, {Set Text( "Value" )} )
 
)
))
 
 
); //end row loop

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
tsolomon
Level III

Re: Evaluating an expression with where function and displaying output

Hi Uday, that did not work; I am unable to evaluate the expression in the
where statement. However, I modified the code you sent me and I am able to
evaluate the expression within the graph title. If I find a way to delete
the text box above the graphs with the following "Where(:Parameter == Eval(
Parse( Eval Insert( "Stmt" ) ) ))" then this should be an acceptable
solution. I am still curious why this works in the graph title but not in
the where statement but that is for my own understanding.

CofA_dt10 = Data Table*(* "GraphData" *)* << *Summary(* Group*(* :Parameter
*)*, Freq*(* "None" *)*, Weight*(* "None" *)* *)*;

output2 = Lineup Box*(* N Col*(* *1* *)* *)*;

row_count = N Row*(* CofA_dt10 *)*;

For*(* w = *1*, w <= row_count - *1*, w++,

Stmt = CofA_dt10:Parameter*[*w*]*;

output2 << *append(*

CofA_dt9 <<

Bivariate*(*

Y*(* :test_value *)*,

X*(* :received_date *)*,

Where*(* :Parameter == Eval*(* Parse*(* Eval Insert*(* "Stmt" *)* *)* *)*
*)*,

SendToReport*(*

Dispatch*(*

*{}*,

"Bivariate Fit of test_value By received_date",

OutlineBox,

*{*Set Title*(* "CofA Parameter Value By received_date" ||" " || Eval*(*
Parse*(* Eval Insert*(* "Stmt" *)* *)* *)* *)}*

*)*,

Dispatch*(* *{}*, "1", ScaleBox, *{*Label Row*(* Label Orientation*(*
"Angled" *)* *)}* *)*,

Dispatch*(*

*{}*,

"test_value",

TextEditBox,

*{*Set Text*(*

"Value"

*)}*

*)*

*)))*

*);*

View solution in original post

4 REPLIES 4
Highlighted
uday_guntupalli
Level VIII

Re: Evaluating an expression with where function and displaying output

@tsolomon
     What you might want to try is this: 

CofA_dt10 = Data Table( "GraphData" ) << Summary( Group( :Parameter ), Freq( "None" ), Weight( "None" ) );
output2 = Lineup Box( N Col( 1 ) );
 
 
row_count = N Row( CofA_dt10 );
 
 
For( w = 1, w <= row_count - 1, w++, 
 
	Stmt = CofA_dt10:Parameter[w]; 
	output2 << append(
		CofA_dt9 << Bivariate(
			Y( :test_value ),
			X( :received_date ),
			Where( :Parameter == Eval(Parse(Eval Insert("\[Stmt]\")) ) ), 
 
			SendToReport(
				Dispatch(
					{},
					"Bivariate Fit of CofA Parameter Value By received_date",
					OutlineBox,
					{Set Title( "CofA Material Parameter Value By received_date" )}
				),
				Dispatch( {}, "1", ScaleBox, {Label Row( Label Orientation( "Angled" ) )} ),
				Dispatch( {}, "test_value", TextEditBox, {Set Text( "Value" )} )
 
			)
		)
	)
 
 
); //end row loop

You essentially want to wrap the eval with an Eval Insert and Parse 

Best
Uday
Highlighted
tsolomon
Level III

Re: Evaluating an expression with where function and displaying output

Thank you Uday but unfortunately, that still doesn't work for me. the title
of the graph appears as "

Where(:Parameter == Eval( Parse( Eval Insert( "Stmt" ) ) ))" instead of
displaying Stmt for each graph. I am using JMP 12 if that makes a
difference.
Cheers,
Tesfu

Highlighted
uday_guntupalli
Level VIII

Re: Evaluating an expression with where function and displaying output

@tsolomon,

  One edit, I think this might work, if not please let me know and I will take a look at it

CofA_dt10 = Data Table( "GraphData" ) << Summary( Group( :Parameter ), Freq( "None" ), Weight( "None" ) );
output2 = Lineup Box( N Col( 1 ) );
 
 
row_count = N Row( CofA_dt10 );
 
 
For( w = 1, w <= row_count - 1, w++, 
 
	Stmt = CofA_dt10:Parameter[w]; 
	output2 << append(
		CofA_dt9 << Bivariate(
			Y( :test_value ),
			X( :received_date ),
		        Eval(Parse(Eval Insert("\[Where( :Parameter == [^Stmt^]\")) ) ), 
 
			SendToReport(
				Dispatch(
					{},
					"Bivariate Fit of CofA Parameter Value By received_date",
					OutlineBox,
					{Set Title( "CofA Material Parameter Value By received_date" )}
				),
				Dispatch( {}, "1", ScaleBox, {Label Row( Label Orientation( "Angled" ) )} ),
				Dispatch( {}, "test_value", TextEditBox, {Set Text( "Value" )} )
 
			)
		)
	)
 
 
); //end row loop

 

Best
Uday
Highlighted
tsolomon
Level III

Re: Evaluating an expression with where function and displaying output

Hi Uday, that did not work; I am unable to evaluate the expression in the
where statement. However, I modified the code you sent me and I am able to
evaluate the expression within the graph title. If I find a way to delete
the text box above the graphs with the following "Where(:Parameter == Eval(
Parse( Eval Insert( "Stmt" ) ) ))" then this should be an acceptable
solution. I am still curious why this works in the graph title but not in
the where statement but that is for my own understanding.

CofA_dt10 = Data Table*(* "GraphData" *)* << *Summary(* Group*(* :Parameter
*)*, Freq*(* "None" *)*, Weight*(* "None" *)* *)*;

output2 = Lineup Box*(* N Col*(* *1* *)* *)*;

row_count = N Row*(* CofA_dt10 *)*;

For*(* w = *1*, w <= row_count - *1*, w++,

Stmt = CofA_dt10:Parameter*[*w*]*;

output2 << *append(*

CofA_dt9 <<

Bivariate*(*

Y*(* :test_value *)*,

X*(* :received_date *)*,

Where*(* :Parameter == Eval*(* Parse*(* Eval Insert*(* "Stmt" *)* *)* *)*
*)*,

SendToReport*(*

Dispatch*(*

*{}*,

"Bivariate Fit of test_value By received_date",

OutlineBox,

*{*Set Title*(* "CofA Parameter Value By received_date" ||" " || Eval*(*
Parse*(* Eval Insert*(* "Stmt" *)* *)* *)* *)}*

*)*,

Dispatch*(* *{}*, "1", ScaleBox, *{*Label Row*(* Label Orientation*(*
"Angled" *)* *)}* *)*,

Dispatch*(*

*{}*,

"test_value",

TextEditBox,

*{*Set Text*(*

"Value"

*)}*

*)*

*)))*

*);*

View solution in original post

Article Labels

    There are no labels assigned to this post.