Dataset with transform on one column

Is it possible to apply a transform on one column of a dataset (from a named query)?

For example, four integers are returned for this one column, 0-3. I would like to display to the user a string text depending on the number.
I've applied an expression transform to the whole dataset, but then I don't get everything else.
Would I need to use toPyDataset?

I don't understand what you're asking.

What is the shape of the data. What is the expression that you're applying to it. And what are you trying to ultimately output?

Column A from the DB table could have values from 0 to 3. I would like to display, in the table column 'One', 'Two', 'Three', for instance, instead of the numerical values.

You can apply a script transform, something like this:

data = system.dataset.toPyDataset(value)
columnAMap = {0:'Zero',1:'One',2:'Two',3:'Three'}
convertedData = [[row[col] if col != 'ColumnA' else columnAMap[row[col]] for col in data.columnNames] for row in data]

return system.dataset.toDataSet(data.columnNames,convertedData)

Probably a more efficient way to do that, but I don't have the brain power tonight. :rofl:


Do it in the query directly.
Either have another table with the mapping to text values and join on that table, or use a case:

  case num_column
    when 1 then ‘one’
    when 2 then ‘two’
from some_table