Get newly created table ID

Options

How can I get the table ID of a table that is created using the Tables: Create a copy of a data table action?

I can't just refer to it by name, because the name is dynamic:


Best Answer

Answers

  • Jeff_146001
    Jeff_146001 Posts: 296 admin
    Options

    I don't recommend using a dynamic output field name. It'll make your life a lot harder.

  • Tom_153935
    Options

    I used a dynamic field name because I want to control the name of that newly-created table. Any idea how I can do that?

  • Tom_153935
    Options

    This field formula works. Is it prone to break, though?

    var str = "supplier-onboarding-tracker-" + fields["my-name"];
    str = str.trim().toLowerCase().replace(/\W*-{2,}\W*/g, '--').replace(/(?!--)(\W+)/g, '-').replace(/^-+/g, '');
    result = fields[str];
    

    The resulting field has the table ID that I wanted.

  • Tom_153935
    Options

    Done!