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

Sequential numbering across different data tables

Hello all, I am pretty new to JSL, so I have this small doubt where I have 3 data tables, and each holds 12 rows. So, I want to add a line of code which gives me an output like for table1-the num col will be 1-12, for table2- the num col will be 13-24 and for table-3 the num col will be 25-36. Can you help me with this. Thank you in advance.

<JSL>

l = 117;

w = 32;

h = 43;

ls = 19.6;

ws = 16.4;

hs = 14.3;

numbers = Function({ls, ws, hs, l, w, layer},
	dt = New Table("data" || Char(layer),
		Add Rows(0),
		New Column("num", Numeric, continuous),
		New Column("length", Numeric),
		New Column("width", Numeric),
		New Column("height", Numeric),

	);
	For(length = ls / 2, length <= l, length += ls,
		For(width = ws / 2, width <= w, width += ws,
			height = Round(hs * layer, 1);

			num = N Rows(dt);
			num++;
			dt << Add Rows(1);
			:num[N Rows(dt)] = num;
			:length[N Rows(dt)] = Round(length, 2);
			:width[N Rows(dt)] = Round(width, 2);
			:height[N Rows(dt)] = Round(height, 2);
		)
	);
	Return(dt);
);

table1 = numbers(ls, ws, hs, l, w, 1);
table2 = numbers(ls, ws, hs, l, w, 2);
table3 = numbers(ls, ws, hs, l, w, 3);
1 REPLY 1
Byron_JMP
Staff

Re: Sequential numbering across different data tables

take a look at the Sequence function.

 

Help>scripting index> search for sequence

 

...or, better:

Start a new workflow, start the recorder

In a data table, make a new column with a formula.

in the formula editor type this - sequence()

the functions arguments will appear, enter start as 1 and end as 12

Apply the formula.

 

Then turn off the workflow recorder, and viola you have a script for adding a column with a formula for a sequence of numbers. 

 

 

JMP Systems Engineer, Health and Life Sciences (Pharma)

Recommended Articles