cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Discovery is online this week, April 16 and 18. Join us for these exciting interactive sessions.
Choose Language Hide Translation Bar
vishwasanj
Level V

column reference plot of graph builder

Thank you for giving amazing suggestions.

I encountered something else and I have always been curious about this. Whenever I come across this, I try to stack to circumvent the problem.

 

In a graph builder, how to plot without knowing the name of the column

 

collist =fudt<< get column names(string);
qdt=Char(collist[9]); //Assuming I want to plot column number 9 on the Y axis, say for example "Data_ABC"
 
gbfc = fudt<<Graph Builder(
Size( 1899, 922 ),
Show Control Panel( 0 ),
Variables(
X( :Index ),
X( :Lot, Position( 1 ) ),
X( :Wafers, Position( 1 ) ),
Y( :qdt),// THIS DOESN't WORK - I want to understand the syntax
Color( :temp )
)
Elements( Points( X( 1 ), X( 2 ), X( 3 ), Y, Legend( 33 ) ) )
);

 

Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
uday_guntupalli
Level VIII

Re: column reference plot of graph builder

@vishwasanj

dt = Current Data Table();
cdlg = Column Dialog( clist = ColList( "Pick 2 Columns", Min Col( 2 ), Max Col( 2 ) ) );
cols = cdlg["clist"];
 
newColExpr = Expr( dt << New Column( "Radius", Numeric, Formula( Sqrt( Expr( cols[1] ) ^ 2 + Expr( cols[2]; ) ^ 2 ) ) ) );
 
Eval( Eval Expr( newColExpr ) );

https://community.jmp.com/t5/Discussions/JSL-Creating-formula-using-a-variable-column-name/td-p/942/...

Best
Uday

View solution in original post

9 REPLIES 9
uday_guntupalli
Level VIII

Re: column reference plot of graph builder

@vishwasanj

dt = Current Data Table();
cdlg = Column Dialog( clist = ColList( "Pick 2 Columns", Min Col( 2 ), Max Col( 2 ) ) );
cols = cdlg["clist"];
 
newColExpr = Expr( dt << New Column( "Radius", Numeric, Formula( Sqrt( Expr( cols[1] ) ^ 2 + Expr( cols[2]; ) ^ 2 ) ) ) );
 
Eval( Eval Expr( newColExpr ) );

https://community.jmp.com/t5/Discussions/JSL-Creating-formula-using-a-variable-column-name/td-p/942/...

Best
Uday
vishwasanj
Level V

Re: column reference plot of graph builder

That was cool. Thank you Uday.
pmroz
Super User

Re: column reference plot of graph builder

Your variable qdt points to the name of the column.  It is not a column itself.  You have to reference it using the construct column(fudt, qdt):

gbfc = fudt << Graph Builder(
	Size( 1899, 922 ),
	Show Control Panel( 0 ),
	Variables(
		X( :Index ),
		X( :Lot, Position( 1 ) ),
		X( :Wafers, Position( 1 ) ),
		Y( Column( fudt, qdt ) ), 	// use column pointed to by the qdt variable
		//Y( :qdt),	// THIS DOESN't WORK - I want to understand the syntax
		Color( :temp ),

	),
	Elements( Points( X( 1 ), X( 2 ), X( 3 ), Y, Legend( 33 ) ) )
);
vishwasanj
Level V

Re: column reference plot of graph builder

Interesting. Let me try that syntax. Thank you pmroz
GoodMan
Level III

Re: column reference plot of graph builder

Uday, 

Thanks for your post. Here i can see the fomula code as follows. Can you explan what means cols&#91;1&#93 and  cols&#91;2&#93?

 

Formula( Sqrt( Expr( cols&#91;1&#93; ) ^ 2 + Expr( cols&#91;2&#93; ) ^ 2 ) )

 

 

uday_guntupalli
Level VIII

Re: column reference plot of graph builder

@GoodMan,
Thanks for pointing out . I recollected and recalled that from the post . Not the way I would do it .

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
ColNames = dt << Get Column Names("String"); 

Stmt = "";
Stmt = ":" || ColNames[2] || "*2";
					   
Eval( Parse( Eval Insert("\[ dt << New Column("Age_Squared",Numeric,Continuous,Formula(^Stmt^)); ]\" ) ) );
Best
Uday
GoodMan
Level III

Re: column reference plot of graph builder

Thanks. Following your new code, go back the the previous example, still i have some problem. Can you help me?

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
cdlg = Column Dialog( clist = ColList( "Pick 2 Columns", Min Col( 2 ), Max Col( 2 ) ) );
cols = cdlg["clist"];
newColExpr = Expr( dt << New Column( "Radius", Numeric, Formula( Sqrt( Expr( cols ) ^ 2 + Expr( cols) ^ 2 ) ) ) );
Eval( Eval Expr( newColExpr ) );

GM

GoodMan
Level III

Re: column reference plot of graph builder

Uday,
I checked your previous code again. Now i understand that &#91=[. So now I can figure it out now. Thank you anyway!
GM
Jeff_Perkinson
Community Manager Community Manager

Re: column reference plot of graph builder

Those were meant to be square brackets. I've edited the post and corrected that.
-Jeff