cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
valeria
Level I

JSL how to reference a table in graph builder

Hallo all,

 

I use a JSL script to generate two tables dt1 and dt1 from an SQL server and then I want graph builder to plot two columns from the first data table I generated. Example below:

 

 

dt1 = Open Database( "BLA", "
SELECT col1, col2
FROM BLA", "data table 1" );

dt2 = Open Database( "BLA", "
SELECT col1, col2
FROM BLA", "data table 2" );

Graph Builder(
    Variables( X( :col1 ), Y( :Tcol2 ) ),
    Elements( Points( X, Y, Legend( 7 ) ) )
);

 

 

But graph builder seems to see only the last table I defined (dt2) not dt1. I tried:

 

Graph Builder(
    Variables( X( dt1:col1 ), Y( dt1:Tcol2 ) ),
    Elements( Points( X, Y, Legend( 7 ) ) )
);

 

but it also does not work. How do I manage?

Thanks for your help.

2 ACCEPTED SOLUTIONS

Accepted Solutions
Thierry_S
Super User

Re: JSL how to reference a table in graph builder

Hi,

 

Specifically, to point to a specific table when working with multiple data tables, you need to point to the table when invoking Graph Builder:

dt1 << Graph Builder(
Variables( X( :col1 ), Y( :Tcol2 ) ),
Elements( Points( X, Y, Legend( 7 ) ) )
);

However, I am not familiar with a method to create a Graph Builder output based on columns selected from two different tables. Hence, you probably need to create a temporary table that contains the desired columns. I'll let others to chime in on this topic.

Best,

TS

Thierry R. Sornasse

View solution in original post

jthi
Super User

Re: JSL how to reference a table in graph builder

I think JMP will set the dt2 as Current Data Table() and because you haven't specified reference for Graph Builder it will use Current Data Table(). To reference datatable you can use dt1 << Graph Builder(...

 

Here is Graph Builder example from Scripting Index:

jthi_0-1632501339624.png

 

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt << Graph Builder(
	Variables(X(:Sex), Y(:Height), Group X(:Age)),
	Elements(Box Plot(X, Y))
);
-Jarmo

View solution in original post

3 REPLIES 3
Thierry_S
Super User

Re: JSL how to reference a table in graph builder

Hi,

 

Specifically, to point to a specific table when working with multiple data tables, you need to point to the table when invoking Graph Builder:

dt1 << Graph Builder(
Variables( X( :col1 ), Y( :Tcol2 ) ),
Elements( Points( X, Y, Legend( 7 ) ) )
);

However, I am not familiar with a method to create a Graph Builder output based on columns selected from two different tables. Hence, you probably need to create a temporary table that contains the desired columns. I'll let others to chime in on this topic.

Best,

TS

Thierry R. Sornasse
valeria
Level I

Re: JSL how to reference a table in graph builder

Thank you very much Thierry, that worked! I understand, I will merge the tables if I have to use the data in the same graph builder.

jthi
Super User

Re: JSL how to reference a table in graph builder

I think JMP will set the dt2 as Current Data Table() and because you haven't specified reference for Graph Builder it will use Current Data Table(). To reference datatable you can use dt1 << Graph Builder(...

 

Here is Graph Builder example from Scripting Index:

jthi_0-1632501339624.png

 

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt << Graph Builder(
	Variables(X(:Sex), Y(:Height), Group X(:Age)),
	Elements(Box Plot(X, Y))
);
-Jarmo