cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Graph Builder Toolbar streamlines interactive graphing. Creates shortcuts on Report and GraphBuilder Helpers toolbars. Download and install the extension.
  • JMP will suspend normal business operations for our Rest and Recharge Day on Friday, October 2, 2026.
    Regular business hours will resume on Monday, October 5, 2026.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
Jo_E
Level III

Adressing a variable number of columns as Y-axis

I have a variable number of columns starting with "Alaska " on this follows a number starting from 01 to a variable maximum, e.g. 11.
I would like to have all these on the same Y column in a graph and the graph should be generated by the script.

I would be interested in the required code for adressing the variable number of Alaskas as Y column in the graph.

So the script should deliver an equivalent to this:
Y( :"Alaska 01"n ),
Y( :"Alaska 02"n, Position(1) ),
...
Y( :"Alaska 11"n, Position(1) ),

It would eb great if someone could help solving this issue.

1 REPLY 1
jthi
Super User

Re: Adressing a variable number of columns as Y-axis

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Semiconductor Capability.jmp");

prefix = "NPN";
cols = dt << Get Column Names("String");

collist = Filter Each({colname}, cols, Starts With(colname, prefix));


gb = Graph Builder(Parallel Axis Merging("Always"));
For Each({colname}, collist,
	Eval(EvalExpr(
		gb << Add Variable({Expr(NameExpr(AsColumn(dt, colname))), Role("Y"), Position(1)});
	));
);

Write();
-Jarmo

Recommended Articles