Writeback query with computed column

Hello all! I built an app to map products; basically it add new rows to an existing table to create 1:1 relationships between two different objects. I created unique id's for each row of this table by adding a dynamic column (a column calculated from other columns). My problem is that I don't know how to add this row's unique ids as new rows are added through the app. So:

  1. Is there a simple way to add unique Id's to new rows in Retool using a writeback SQL query?
  2. Has anyone written an INSERT INTO statement with a combination of items and a calculated column? I imagine it would look something like this:
    "INSERT INTO name_of_table (product, number, menu_type, size, comp_name,
    comp_product_name, comp_number, comp_size, row_id AS number || comp_number)
    VALUES ({{select1.selectedItem.PRODUCT_NAME}}, {{parseInt(select2.value)}},
    {{select3.value}}, {{select4.value}}, {{select5.value}},
    {{select6.selectedItem.PRODUCT}}, {{parseInt(select7.value)}}, {{select9.value}});
  3. If the previous two options are not possible, is there a way to trigger a second process to run at the same time as the writeback query is triggered? Meaning: As the user inserts a new row another query would be triggered with an UPDATE statement.

Hi @jblanco, do you want to store the unique id in your database or only have this as a row in your table? If you want to add this to your database, you will need to create a new column in your database schema for this id and then you can do something similar to your second option given above. If you simply want this to be rendered in your table, you can add a new column to your table and set the value of that column to reference multiple other columns (something like {{currentSourceRow.column1}}.{{currentSourceRow.column2}}. Hope this helps!