Update sql table since Power Table

Hi i tried to update a sql table since a power table i took the code from this url

https://docs.inductiveautomation.com/display/DOC80/Updating+the+Database+through+the+Power+Table#UpdatingtheDatabasethroughthePowerTable-UsingaPowerTableComponent

but when i try to make a test the table don´t change anything and the value returns to the original value, don´t sends an error.

I checked the client permission and is Read/write.

can you help me?

thanks

find the problem, someone knows how to solve this?

It would be helpful if you showed us your code, but at a guess, you are trying to use event, where no event exists.

If you look at the example at the link you posted, you will see they use self.

Hi Jordan

With selft is the same error “NameError: name ‘self’ is not defined”

.

Here the code

Hi Eric,

The indentation needs to match the rest of the function. Put a tab space in front of your lines to match the tab spacing above it.

Hi

i puted the indentation and woorks the first two lines but now i have other error

move the identation, checked the query and other things and the same error

thanks for your help.

Hard to tell from the limited error message you posted. Somewhere in there should be a ‘Caused by’ line that may provide a clue.

Is the database on the default connection? If not, you’ll need to specify the correct db connection. It’s a good habit to always specify it anyway, because if you run the function from the gateway, you must tell it the connection. Always specifying it covers all instances.

1 Like

Also, the Legacy Database Access permission must be enabled.

Hi Jordan i soved my problem,

in the line needs to put the name of the dataBase

system.db.runPrepUpdate(query, args, ‘your database’)

2 Likes