I have an Ignition script that contains this…
name = “example”
ID = 1
getLID = system.db.createSProcCall("GetLIDByIDName", "Ignition")
getLID.registerReturnParam(system.db.INTEGER) #registerOutParam("LID", system.db.INTEGER)
getLID.registerInParam("name", system.db.VARCHAR, name)
getLID.registerInParam("ID", system.db.INTEGER, ID)
system.db.execSProcCall(getLID)
LID = getLID.getReturnValue() #LID = getLID.getOutParamValue()
and a store procedure that looks like this…
CREATE PROCEDURE [dbo].[GetLIDByIDName]
@ID AS int,
@name AS varchar
AS
DECLARE @LID int
SELECT @LID = [LID] FROM [Ignition].[dbo].[LTable]
WHERE [ID] = @ID
AND [Name] = @name
RETURN @LID
Instead of getting the correct value in LID, I always get 0 (I have tested the stored procedure and it does give values other than 0). So, I think maybe I should be using what I have commented above in the script. But I am not really sure what the difference is between getReturnValue and getOutParamValue. Can someone explain the difference between SProcCall.getReturnValue() and SProcCall.getOutParamValue(index OR name) and in what scenario each one should be used? Please share if you see anything else that might be causing this too, thanks.