Perspective Table Edit Dataset

I'm trying to edit values of a dataset by converting it into a py dataset but I'm not having any luck.


When I submit an edit to a cell I get this error.

Is there a better way to edit a dataset in a table?

Thanks!

  1. Never post code different than the exact code which encountered the issue. The line number referenced in your failure message is a comment in the screenshot.
  2. Never post code as a screenshot - give us the code in a pre-formatted snippet so that we don't have to write it ourselves in order to help you troubleshoot.
  3. Yes, there's a better way: system.dataset.setValue - Ignition User Manual 8.1 - Ignition Documentation

So your code would look like this:

self.props.data = system.dataset.setValue(self.props.data, event.rowIndex, event.column, event.value)
3 Likes

FYI the error in your screenshot was likely caused by event.column in line 7 of your code screenshot. You'll notice under arguments that event.column can be a str or string value. The column index value for your pyDataSet must be an integer.

1 Like

That's just the function I needed! It's working now.

Sorry :grimacing:! I went back and added those 4 comments and forgot to re screenshot the error. I'll keep these in mind for next time!

Thanks for the quick reply!

1 Like

Ahhh, that makes sense. Thanks for pointing that out!

1 Like