Stored Procedure Issue - Error_TypeConversion

Hi All,

I have an issue when a stored procedure is called from a Tag Change Event - Gateway Event Scripts.

The script is the following:

forno = '[MP4]Forni Invecchiamento/Eventi/Pw_Int_F1'[-1:] # Determino quale forno ha lanciato la script ( 1 = MF06 | 2 = MF07 )

IDFornoInvecchiamento = 'MF06'
NumeroInfornata = system.tag.readBlocking(['[MP4]Forni Invecchiamento/Pagine/Data_Recipe_String_F{}/01'.format(forno)])[0].value
DurataPrevistaMinuti = system.tag.readBlocking(['[MP4]Forni Invecchiamento/Pagine/Data_Recipe_int_F{}/08'.format(forno)])[0].value

print forno
print IDFornoInvecchiamento
print NumeroInfornata
print DurataPrevistaMinuti

call = system.db.createSProcCall("[dbo].[spScadaAperturaInfornata]","SomeDatabase")
call.registerInParam(1, system.db.CHAR, IDFornoInvecchiamento)
call.registerInParam(2, system.db.CHAR, NumeroInfornata)
call.registerInParam(3, system.db.SMALLINT, DurataPrevistaMinuti)

The results are:

[Error_TypeConversion("Error trying to coerce 'mf06' to a number.")]

I tried to use named argument names instead of indexed arguments but it’s the same.
Ignition 8.0.9

Any help?


Without the stored procedure all I can guess is that somewhere in it, you are doing an INT or number type casting of your first parameter (IDFornoInvecchiamento) which is not working given the ‘m’ in front of it. Post the stored procedure logic.

Try passing that with quotes on it.

call.registerInParam(1, system.db.CHAR, "MF06")

Thanks for the support guys :slight_smile: but I don’t know how or why today is working :sweat_smile:
@bkarabinchak.psi inside the stored procedure there is no number type casting
@MMaynard I tried that ( yesterday )but the same result.

Anyway, as I said, now is working.
Thanks again for the help :heart:

1 Like