Column switcher and Graph BuilderHi,
I have a number of columns which I have grouped together.
In the graph builder I have the X axis constant, but the Y axis should have the column switcher function where we can chose which parameter we want to switch between from the said group of columns.
First I tell JSL what columns should be in the group and which column should be my first column
colList = dttable << get column names( continuous );
col1 = colList[1];
This is the code and the error I am getting,
Graph Builder(
Size( 570, 621 ),
Show Control Panel( 0 ),
Show Legend( 0 ),
Variables( X( :batch_no ), Y( :col1 ) /*###*/ ),
Elements( Points( X, Y, Legend( 8 ) ) ),
Column Switcher( :col1, {:colList} )
)
Can you tell me what I should write for the Y variable so I can get the first column to start with and then add the column switcher.
Thanks in advance
Basic Data Analysis and ModelingData AccessDesign of ExperimentsWindowsRe: Column switcher and Graph BuilderYou are specifying
:col1
The colon is telling JMP there is a column in the data table called "col1"(see scoping in JMP documentation); Col1 is a memory variable, not a column. Remove the colon and your code should work.
Re: Column switcher and Graph BuilderHi Jim,
Thanks for your help.
I get the graph now, but the column switcher still does not work.
dtrelsplit << Newscript ("graph",
Graph Builder(
Size( 570, 621 ),<BR />
Show Control Panel( 0 ),
Show Legend( 0 ),
Variables(
X( :batch_no ),
Y(col1),
),
Elements( Points( X, Y, Legend( 8 ) ) ),
Column Switcher(
col1, {colList}
),
),
Column Switcher cannot find specified column col1 in platform script</CODE></PRE><P>This is the error shown</P><P> </P></LINGO-BODY><LINGO-SUB id="lingo-sub-724513" slang="en-US" mode="CREATE">Re: Column switcher and Graph Builder</LINGO-SUB><LINGO-BODY id="lingo-body-724513" slang="en-US" mode="CREATE"><P>Here are my modifications</P>
<PRE><CODE class=" language-jsl">Graph Builder(
Size( 570, 621 ),
Show Control Panel( 0 ),
Show Legend( 0 ),
Variables( X( <SPAN class="lia-emoticons-autosuggestions"><SPAN class="lia-emoticons-search-term">:batch_no</SPAN></SPAN> ), Y( as column(col1) ) ),
Elements( Points( X, Y, Legend( 8 ) ) ),
Column Switcher( col1, colList )
)
;
colList is a list, so it does not require a second set of {}
Re: Column switcher and Graph BuilderThanks
Re: Column switcher and Graph BuilderHas JMP become stricter?
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
colLst = { :Height, :Weight, :Age };
// doesn't work
dt << New Script( "test",
Graph Builder(
Variables( X( :Weight ), Y( :Height ) ),
Elements( Points( X, Y ) ),
Column Switcher( :Height, colLst )
)
);
// does work
dt << New Script( "test2",
Graph Builder(
Variables( X( :Weight ), Y( :Height ) ),
Elements( Points( X, Y ) ),
Column Switcher( :Height, { :Height, :Weight, :Age } )
)
);
// does work
Eval( Eval Expr( dt << New Script( "test3",
Graph Builder(
Variables( X( :Weight ), Y( :Height ) ),
Elements( Points( X, Y ) ),
Column Switcher( :Height, Expr( colLst ) )
)
)));
Re: Column switcher and Graph BuilderWhat two versions of JMP are you referencing?
Re: Column switcher and Graph BuilderJMP19.
edit: I wouldn't be able to tell without effort whether the colList variable worked in JMP18 or earlier. I am surprised because I have found several references regarding the use of variables having lists passed to them for further use.
Re: Column switcher and Graph Builder@Ressel ,
Using a newly executed, therefore, clean instance of JMP 18, the example script you included of the case you implied was working for you in JMP 18 did not work for me.
The issue is because of the isolation that JMP provides for the sample script you included, where it has as the first line
Names Default To Here( 1 );
This function isolates the variables created to be unique to that execution of the script. Therefore, the variable collist is only known to the script when it is run. When the embedded script that is saved to the data table is run, that is a new script environment, and it does not have the variable collist defined.
The reason your two versions of the code that do execute properly, do actually work is because in the first case, the values are hardcoded into the script, and in the second case, the
Expr( colLst )
expands the variable colist into hardcoded values before the code is executed, making the script embedded in the data table a hardcoded version of the script.
Thus, in your case, JMP 19 has not changed from version 18
Re: Column switcher and Graph BuilderAh, OK. I assume this is what is a "name space" issue?
Also, I did not claim it worked for me in JMP18. I was wondering why the solution that was proposed here and looked so clear didn't work. I then incorrectly suspected it may be related to JSL's evolution. This is not the case.
Thanks for the clarification!
Re: Column switcher and Graph Buildergreat conversation : )
magnifier glass on the nuts and bolts of JSL ...
I just wondered about the difference between Variables() and Column Switcher() in
Variables( ... Y( as column(col1) ) ),
Column Switcher( col1, colList )
This one works as well:
Names Default to Here(1);
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
cols = dt << get column names( continuous );
col1= cols[1];
gb = dt << Graph Builder(
Size( 437, 413 ),
Graph Spacing( 4 ),
Variables( X(col1 ), ),
Elements( bar( X ), ),
Column Switcher( col1, cols )
);
as well as this one:
Names Default to Here(1);
dt = Open( "$SAMPLE_DATA/Big Class Families.jmp" );
cols = dt << get column names( continuous, "String" );
col1= cols[1];
gb = dt << Graph Builder(
Size( 437, 413 ),
Graph Spacing( 4 ),
Variables( X(Column(col1) ), ),
Elements( bar( X ), ),
Column Switcher( col1, cols )
);
what doesn't work:
Names Default to Here(1);
dt = Open( "$SAMPLE_DATA/Big Class Families.jmp" );
cols = dt << get column names( continuous, "String" );
col1= cols[1];
gb = dt << Graph Builder(
Size( 437, 413 ),
Graph Spacing( 4 ),
Variables( X(col1 ), ),
Elements( bar( X ), ),
Column Switcher( col1, cols )
);
so, Column Switcher() is fine with a String,
Variables() needs a name - or a column (created via As Column() or column())
Re: Column switcher and Graph Builder@hogi is the meaning of your results that it is not an environment or name space issue, but something different?
Re: Column switcher and Graph BuilderNo, the issue with the table scripts is a namespace issue, as @txnelson explained.
String vs. name vs. Column is just something else one can learn about.