Forum Discussion
Hello dmurphy,
I'm not fluent at Widget scripts, but something like this may work. If not please let us know and we can dig further into it.
widget.on('render', function(widget, args){
var data = widget.queryResult.rows; // assuming your data is in rows
for (var i = 0; i < data.length; i++) {
var value = data[i].your_column_name; // replace your_column_name with the actual column name containing 1s and 0s
if (value === 1) {
data[i].your_column_name = "Yes";
} else if (value === 0) {
data[i].your_column_name = "No";
}
}
widget.queryResult.rows = data;
});
Replace `"your_column_name"` with the actual name of the column containing the 1s and 0s in your data. Make sure to configure this script in your Sisense widget script editor, and it will transform the values accordingly whenever the widget is rendered.
Thank you.
- dmurphy04-17-2024Data Storage
Hi DRay ,
Many thanks for your contribution. At the moment the data is remaining at 0 and 1 when running the script in the Widget Editor. Would there be any steps that must be taken after entering and saving the code to put the script into effect? I save the script and then refresh the page.
For your_column_name, does this refer to the name of the field in the Sisense cube, or what I have renamed it to on the widget? I have tried the script above for both, but unfortunately no luck!
Thanks again,
Darragh