Button doesn't work


Setup :

  • SeaTable Cloud

Problem/Error/Question :

I tried to use the button to copy a row, when clicked, in another table. But nothing happen when I click on

And of course, I have the right field in the second table.

Do you have any idea about this matter ?

Thanks in advance.

I can confirm that this works:

Peek 2024-07-05 15-36

Are you sure that the column names are completely identical as described here?

Thanks Christoph

I checked my column fields and I corrected 2 fields, but not all fields are copied. In fact, only “Assignée à” and “Ref Dde” have been copied.

Here my source table

Here the other table, where I have some other fields

Is’it because some fields are relation field in both tables (same relation of course) ?

Should I have the same number of column in both tables ?

Thanks again

The cell values in link and link formula columns are computed by the system. They cannot be manually filled. As a consequence, you cannot copy values in columns of these types.

The content of link columns is NOT copied.

Ok I better understand. Would this be possible using a script ?

Thanks to you

To do what? Please elaborate.

I mean to read the data in a row, transcript datas if necessary, and then copy them in another table in order to be sent in a template to be published.

My idea is to collect all rows from an order and to send the information in a template. But with a script, it is perhaps possible to directly extract the right information and send it to a template.

I try to understand how buttons can help to reach my need.

Bonsoir Nathalie !

I prepared an answer this afternoon, but I didn’t have time to post it, and now that I see your last message, I’m not so sure it fulfills your needs :thinking:
I thought your question was to know if it’s possible to copy every data from one table to another, including the data in the link-type columns…
For that purpose, I wrote this JavaScript script:

const sourceTable = 'Table1';
const targetTable = 'Table2';
const table1  = base.getTableByName(sourceTable);
const view = base.getViewByName(table1, 'Default View');
const tables = base.getTables();
const columns1 = base.getColumns(table1);
cols1 = []
columns1.forEach((column) => {
  if (column.type != "link-formula" && column.type != "formula") {
    if (column.type=='link') {
      cols1.push({'name': column.name, 'type': column.type, 'other_table': column.data.other_table_id});
    else {
      cols1.push({'name': column.name, 'type': column.type});
const table2  = base.getTableByName(targetTable);
// HERE you could eventually verify that every column present in your source table has its equivalent in your target table... 
const row = base.context.currentRow;
cols1.forEach((col) => {
  if (col.name in row && row[col.name]!=null){
    if (col.type!="link") {
      data[col.name]= row[col.name];
    else {
      let linkId = base.getColumnLinkId(targetTable, col.name);
      let currLinks = [];
      row[col.name].forEach((link) => {
      links.push({'linkId': linkId, 'col':col.name,'ids':currLinks, 'other_table': col.other_table});
let newRow = base.appendRow(table2, data);
links.forEach((link) => {
  let other_table_name="";
  for (let i=0;i<tables.length;i++) {
    if (tables[i]._id == link.other_table) {
      other_table_name = tables[i].name;
  output.text('other table : '+other_table_name);
  base.updateLinks(link.linkId, targetTable, other_table_name, newRow._id, link.ids);

Of course you’ll have to change the names of your source and target tables on the first two rows.
As I use base.context.currentRow to get the current row, this script as to be launched on a specific line from a button.

To answer more specifically your last post, you can definitely imagine a script that gets directly the data from every rows, and even choose which columns you want to transfer. For now, my current script transfers data from every columns except from formulas and link-formulas columns, but it also considers that the target table already contains all the columns to transfer from the source table (there is no test for that, but it is also possible to check whether the columns exist or not, and even to create them when they don’t).
As far as I understand your problem, I’m not sure that buttons can help you that much as you talk about collecting all rows at once: buttons generally trigger an action (one of the proposed one or launching a script) for the current row. Personally, I use them only when I need a “row-specific” behaviour, otherwise I just create a script that I launch from the scripts panel.

Hope this helps,
Feel free to ask if you want some help about a specific script !


1 Like

Hey Benjamin

Thanks a lot for the script. I understand it’s the same as offered in the button action. Is it ?


If your answer is Yes, it doesn’t allow to copy every column, I mean formulas and link column.
Idealy, I would like to be able to edit a document like this one.

I think I need first to gather all rows for the same order in a separate table and then, use a button to publish a PDF. Am I right in the process ?

If you prefer, I can explain in French in mp.

Thanks again.

Ps : I tried your script after changing the name of tables. But I got an error message

Hi @NathalieB ,
It doesn’t do exactly the same as the “Copy line” button action, as the content of the link-type column is also copied (the script creates a new link in the target table to the original record the source row was linked to).
I didn’t make it copy the content of the formula-type columns because I considered that the source and the target tables will have a same columns, including the formula-type ones, with the same formulas, so copying the data feeding the formulas should be enough…

I’m sorry you got an error using the script. It seems that the script isn’t able to find the current row, which is pretty weird…

About the process, I’m not sure you need to gather all rows from the same order in a separate table : if you do so and try to generate the document from this new table, you won’t be able to fill summarized values as VAT or Global Amount. For me, you’ll need to have an “orders” table and a “rows” table, each row being linked with one or more order. Doing so, you’ll be able to access every order’s row in the orders table, and compute the summarized values using rollup functions. Then, you can generate your document from a single row of the orders table.

I agree with you, it will probably be easier in French :joy:. Let’s continue this discussion in private message, we’ll publish only the final solution for those who might be interested.


1 Like