I am trying to consolidate some code and use three lists to populate the.registerInParam function. I am using it to call a stored procedure. I originally had left out lines 2-7, and used the next four lines in order to pass in four parameters into the stored procedure and it worked using lines 8-11. Using lines 2-7 I get the error below. Below is the code:
call = system.db.createSProcCall("CreateLotRecords")
ParamNum = [1,2,3,4]
Type = ["system.db.VARCHAR","system.db.VARCHAR","system.db.VARCHAR","system.db.INT"]
Value = ['L20','P20','H20',20]
i = 0
for i in range(4):
call.registerInParam(ParamNum,Type,Value)
# call.registerInParam(1, system.db.VARCHAR, 'L20')
# call.registerInParam(2, system.db.VARCHAR, 'P20')
# call.registerInParam(3, system.db.VARCHAR, 'H20')
# call.registerInParam(4, system.db.INTEGER, 20)
system.db.execSProcCall(call)
I am getting the following error when I try to run the script with line 8 being call.registerInParam(ParamNum,Type,Value):
com.inductiveautomation.ignition.common.script.JythonExecException
Traceback (most recent call last):
File âfunction:runActionâ, line 8, in runAction
TypeError: registerInParam(): 1st arg canât be coerced to int, String