Edicion de una tabla con onCellEdited

saludos estoy configurando una tabla con onCellEdited uso la versión 7.9 este es mi código

row = rowIndex
col = colIndex
colName = colName

ID = self.data.getValueAt(rowIndex,'id')
query = "UPDATE AguaControl.Agua SET %s = ? WHERE id = ?" %(colName)
system.db.runPrepUpdate (query,ID,'AguaControl')
system.db.refresh(self,"data")

pero no me funciona no se donde esta el error podrian ayudarme

You probably need your runPrepUpdate parameters in a list. You also need as many items in this list as there are question marks in your query.

system.db.runPrepUpdate (query,[SET_VALUE,ID],'AguaControl')
fill the variable SET_VALUE however you would like.

Ignition Docs

query = "UPDATE AguaControl.Agua SET Consumo_Total = ? WHERE id = ?" %(colName)
system.db.runPrepUpdate (query,[id,Consumo_Total])

complete mi codigo y lo reduje de esta manera pero aun no me funciona cual es mi error ?

Your parameters need to be in the order of the question marks.

Try:
system.db.runPrepUpdate (query,[Consumo_Total,id])

If that doesn’t work, copy the error message and post it here.

lo hice pero no funciono y no puedo publicarte un error porque no me reflejo uno simplemente la tabla no se deja editar me siento en un callejón sin salida

image

Open the console and see if there is an error message.

If there isn’t an error message, try calling IA support.

tenias razon

Caused by: org.python.core.PyException: Traceback (most recent call last):
  File "<extension-method onCellEdited>", line 27, in <module>
NameError: name 'self' is not defined

este es mi error

This line:

ID = self.data.getValueAt(rowIndex,'id')

Needs to be

ID = event.source.data.getValueAt(rowIndex,'id')
Caused by: org.python.core.PyException: Traceback (most recent call last):
  File "<extension-method onCellEdited>", line 27, in <module>
NameError: name 'event' is not defined

tengo este error ahora

Sorry… it should be self.data not event.source.

Can you post your entire script including the def onCellEdited part all the way to the bottom?

#rowIndex = row
#colIndex = col 
#colName = colName

ID = self.data.getValueAt(rowIndex,'id')
query = "UPDATE AguaControl.Agua SET %s = ? WHERE id = ?"%(colName)
system.db.runPrepUpdate(query, [value,ID], 'AguaControl')
system.db.refresh(self,"data")

este es

You are missing the

def onCellEdited

at the beginning. I want to see the ENTIRE script not just your part (If you can)

si claro, aqui esta :

OK… all your scripting is not indented properly.

You need to indent each of your lines with a tab to be properly indented.

ENTIEDO


lo hice asi pero me aparece un error en la primera linea
al momento de dejarlo sin sangria el error desaparece

If you hover your mouse over the red mark you might get an idea of the error

You have got some fundamental issues with your script. You are writing to rowIndex,colIndex etc…

Try this:

	ID = self.data.getValueAt(rowIndex,"id")
	query = "UPDATE Agua SET %s = ? WHERE id = ?" %(colName)
	system.db.runPrepUpdate(query, [newValue,ID], "AguaControl")
	system.db.refresh(self,"data")

Remove all the code that you have an just put that in. Make sure that it is properly indented.

tengo este error

 Error invoking extension method.
org.python.core.PyException: Traceback (most recent call last):
  File "<extension-method onCellEdited>", line 24, in onCellEdited
TypeError: not all arguments converted during string formatting

So are things working or do you still have issues?

aun tengo problemas

ERROR Vision.Components.AdvancedTable - Error invoking extension method.
org.python.core.PyException: Traceback (most recent call last):
  File "<extension-method onCellEdited>", line 25, in onCellEdited

este es mi error

OK… can you post your entire script again? Use the </> option to post it. Please include the entire script.