Scripting in Seatable (Javascript FOR statement)


I am trying more scripting in Seatable and I am trying to do a nested FOR loop but it does not want to work. Does Seatable not support nested FOR statements? I am following the same structure as it would be in Java script.

Below is my code and also screenshots of my data:

var date = new Date();
let today = base.utils.formatDate(date);
const copyTableName = 'Personnel';
const copyViewName = 'Default View';
const copyColumnName = 'Name';
const copyColumnEmail = 'Email';
const pasteTableName = 'Tasks';
const pasteViewName = 'Default View';
const pasteColumnName = 'Name';
const pasteColumnEmail = 'Email';

const Table = base.getTableByName(copyTableName);
const View = base.getViewByName(Table, copyViewName);
const Rows = base.getRows(Table, View);
const outputTable = base.getTableByName(pasteTableName);
const outputView = base.getViewByName(outputTable, pasteViewName);
const outputRows = base.getRows(outputTable, outputView);

for (let i = 0; i < Rows.length; i++) {
  for (var a = 0; a < outputRows.lenght; a++) {
    output.text("Personal "+i);
    output.text("Tasks "+a);

At the moment, all I am trying to do is get it to display the number of rows it counts. It returns nothing. If I break it down it down so that its not a nested FOR loop it works fine.



SeaTable uses standard JavaScript language, so nested FOR statement should be supported.

Thanks @daniel.pan but why does mine not work? This is what I get. Is there something wrong with my code? Broken down into the individual FOR loops it works but nested it doesn’t work.

@daniel.pan Then there must be a bug because mine are not working and I have followed the Javascript structure. I cannot see anything wrong with my code, maybe you can and prove there is not a bug?


Can you share

Can you send me the base sharing link? I will take a look.

Thanks @daniel.pan

Appreciate it.

It is length, not lenght.

Oh my goodness. I have been staring at my code for hours scratching my brain and I never picked up that spelling error. I feel foolish :upside_down_face:

Thanks @daniel.pan. Its run into another problem by looping though 3 times over. But I will look at that another day. I need to check my spelling.