大家好,我对 JSL 还很陌生,所以我有点疑惑,我有 3 个数据表,每个表包含 12 行。因此,我想添加一行代码,它能给我一个输出,例如对于表 1,列号将是 1-12,对于表 2,列号将是 13-24,对于表 3,列号将是 25-36。你能帮我吗?提前谢谢您。
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);看一下序列函数。
帮助>脚本索引>搜索序列
...或者更好:
启动新的工作流程,启动录音机
在数据表中,使用公式创建新列。
在公式编辑器中输入 -sequence()
函数参数将会出现,输入开始为 1,结束为 12
应用公式。
然后关闭工作流记录器,您就会得到一个用于添加带有数字序列公式的列的脚本。