I've been working on trying to find a way to display only the data I am interested in from a pydataset using a transform. I've tried a few different types of transforms to make this happen and I've been unsuccessful and I'm hoping someone can give me a hand.
I currently have a named query binding on a table in perspective that is returning a dataset. What I want to do is go into this dataset and make it so only 2 of the 3 roles I have set for a specific user appear on the table.
It would look something like this:
where the role "Administrator" does not appear on the table for example.
If the roles field is a string then a script transform like this might work:
for row in range(value.getRowCount()):
newData = system.dataset.setValue(value, row, 'role', value.getValueAt(row, 'role').replace('Adminstrator,', ''))
I think @pturmel's simulation aids module might be able to do what you want with expressions.
I was using a modification of the script you sent me but it seems to only work for 1 row and any row after that the role will still appear. Specifically, it only works for the last row in the table of question. How would I go about modifying it again so that it will modify all the rows?
The problem with this script is that it uses
value as the source dataset but assigns the result to
So on every iteration, it still uses the original dataset, which is why you only get the very last modification.
To fix it, replace
That makes a lot of sense and I'm sad I overlooked that, but that's okay.
Thank you @pascal.fragnoud