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?
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.