In the result set above if the deleted_at field is null the State column of the table should be "Cancelled" and if the cancel_at field is null, the State column of the table should be "Deleted".
Here's what the expected end result should look like:
However, it doesn't update the "State" column in the table. I think I now see what the issue is. State field is a custom column added to the table component, when I added a console.log statement in your code and I can see all the fields of the database except State. So that could be the issue. See this screenshot:
are you running that in the actual transformer section of your query? If so I dont think you need to add the let data = {{ table1.data }} just reference data directly.
But anyways, depending on your data source...i find the easiest way sometimes is to just add a 'fake column' in the query...something like
select col1,col2,col3, NULL as State from myDb - that is in a MySQL database, fyi. But somethign similar should be possible in other db's, and then you can simply work with that column like the others...edit the value int he transformer etc, and not have to mess with custom columns.
Now that you say its a custom column actually - you could just leave the original query alone entirely, and just use some ternary inside the custom column like so:
@Anand just want to pop in here to mention that from the screenshot it looks like you're using a transformer. It's important to use a JavaScript query here like @msd5079 is referring to, otherwise, you won't be able to call setData on your table.