Editable Table: How to do an update of the table via Row-ID?

Hi,
I am using an editable table in my app. From the docu I see, that I need to trigger a workflow via a microservice, which works fine.
Now I need to create the new table (based on the user input in the app frontend) in my workflow. The docu tells me I can use the Row-ID, that was sent via the microservice for that.
How can I retrieve the Row-IDs of my original data table in my ONE DATA workflow to find the updated rows?

Thanks in advance!

1 Like

By default the ROW_ID should come automatically through all the stack of sqls if you do not use custom sqls at any stack layer like virtual data tables or sql at datasource or element.
But if you at any place work with column selection or subqueries explictly you also have to carry this ROW_ID column all the way through explictitly.

The screenshot shows the simple way on the top with no sql and the row_id gets send automatically to the workflow. But on the bottom right I use explicit column selection at at least one place, then i have to adress also the row id column to get the same result. otherwise in my test the workflow does not get triggered at all with edit a row.

This is at least my experience, maybe this helps you as starter to solve your scenario

3 Likes

Maybe a short addition to this:
You don’t need to explicitly query the data if you want to get the original values of the updated or deleted rows of your apps table. The full rows are provided at the microservice input processors even if your table only shows a subset of all columns.

If you don’t know the exact schema of the data (or don’t want to define it) you can enable the “Ignore Schema Mismatch” option in the microservice input processors (you may need a Manual Column Specification processor after the input if you want to operate on certain known columns). For the rows deleted in the table, only the row ID column is provided by default. You can change this behaviour by setting saveToMicroservice.fullDeletedRows: true in your tables element definition. In this case also all columns will be provided in the Input_deleted_rows microservice input of your workflow.

1 Like

Thanks for your input, but I don’t quite get your points :upside_down_face:

Maybe I rephrase my question:
In the microservice workflow I need to gather all the new rows (added rows and updated rows), but I also need to retrieve all unchanged rows from my initial table in order to append the unchanged to the (newly) changed rows and replace the resp. datatable.
And in order to find out, which rows were not changed by the user, I need to find the row-IDs in my datatable that are not coming from the microservice inputs. So somehow I need to know the row-ID of each row I load with the datatable load processor.
Have a look at the workflow I think I need to setup:

Do I have a misunderstanding in how this table editing workflow should look like?

There is a way to get the row IDs from your “Data Table Load” Processor:

  1. Add a “Data Table Load” Processor to your Workflow
  2. In the Processor, hit Shift+Alt+E to enter the “expert mode”
  3. Under loadingOptions.addRowIdColumnAs, set it to "__ROW_ID__"

An example configuration could look like this:

{
  "dataLocation": {
    "reference": {
      "type": "referenceByName",
      "name": "here_goes_your_table_name"
    },
    "loadingOptions": {
      "includeRowIdColumnAs": "__ROW_ID__"
    },
    "type": "useDataValue"
  },
  "parseMode": [
    "FAIL_FAST"
  ]
}
3 Likes

Ahh the expert-mode, thanks @christopher.roppelt !

@thommy.bachmaier : Maybe it is worth mentioning this in the docu of editable tables, since without that info you are not able to implement this feature. A small minimal working example of an app with a workflow would be great, such that people in the future could simply reuse this instead of going through all the steps again. :slight_smile:

3 Likes