Ciao a tutti, sono piuttosto nuovo di JSL, quindi ho questo piccolo dubbio in cui ho 3 tabelle di dati, e ciascuna contiene 12 righe. Quindi, voglio aggiungere una riga di codice che mi dia un output come per table1-il num col sarà 1-12, per table2- il num col sarà 13-24 e per table-3 il num col sarà 25-36. Potete aiutarmi con questo? Grazie in anticipo.
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);diamo un'occhiata alla funzione Sequenza.
Aiuto>indice scripting>cerca sequenza
...o meglio:
Avvia un nuovo flusso di lavoro, avvia il registratore
In una tabella dati, crea una nuova colonna con una formula.
nell'editor di formule digita questo - sequence()
appariranno gli argomenti delle funzioni, inserisci inizio come 1 e fine come 12
Applica la formula.
Quindi disattiva il registratore del flusso di lavoro ed ecco che hai uno script per aggiungere una colonna con una formula per una sequenza di numeri.