Adding column to table with query bound dataset

Is there a way to add another column to a table with a dataset from a transaction group?

I want to match the code from the first column to text that I would put in the added column.

The text associated with the code number is not in my transaction group.
Like if I know 2101 means the part is too small, and I want my table to also show the reason.

You can use system.dataset.addColumn() to do this.
https://docs.inductiveautomation.com/display/DOC81/system.dataset.addColumn

thanks

If you’re querying a database you can also add it to your query. Something like:

SELECT
  statusInt,
  CASE statusInt
    WHEN 1 THEN 'ON'
    WHEN 2 THEN 'OFF'
    ELSE 'ERROR'
    END as explanation,
  colA,
  colB
FROM tableA

There might be a better way than CASE. If there is I’m sure someone will suggest it.

An oft-used method would be to create another db table with the codes and descriptions on it, the use a JOIN clause in the query

SELECT table1.col1, table1.col2, table1.status, table2.description
FROM table1
LEFT JOIN table2 ON table1.status = table2.status
1 Like

that seems very efficient

what is the good way to create the table?

Your DB tool of choice (Management Studio, Workbench, DataGrip, et al) is fine. This, generally speaking, would be a static table, once all your codes are in.