I have a SQL function set up to calculate premiums. I'm trying to calculate the premium as we enter a new record and call the procedure from Powerapps with a Flow. I keep getting the error Procedure or function fn_XXXX_GetPremiumPowerApps has too many arguments specified. I have 4 parameters that are flowing into the correct variable. The function works fine in SQL. Can't get it to test correctly. Rebuilt it completely in a new flow and still the same error.
Raw Inputs:
{
"host": {
"connectionReferenceName": "shared_sql",
"operationId": "ExecuteProcedure_V2"
},
"parameters": {
"server": "xxxxxxxx.database.windows.net",
"database": "xxx_Replica",
"procedure": "[dbo].[fn_xxxx_GetPremiumPowerApps]",
"parameters/CoverageAmt": 500000,
"parameters/CoverageType": "I",
"parameters/IMISID": "60142",
"parameters/PlanCode": "xxxx-Nationwide"
}
}
Error
"body": {
"message": "Procedure or function fn_xxxx_GetPremiumPowerApps has too many arguments specified.\r\nclientRequestId: 42a1dd20-558c-4191-b10d-e9eac6d0b36b",
"status": 400,
"error": {
"message": "Procedure or function fn_xxxx_GetPremiumPowerApps has too many arguments specified."
},
"source": "sql-cus.azconn-cus-001.p.azurewebsites.net"
}
}
This is the SQL function:
ALTER FUNCTION [dbo].[fn_XXXX_GetPremiumPowerApps] (@IMISID VARCHAR(10), @PlanCode NVARCHAR(20), @CoverageType VARCHAR(1), @CoverageAmt money) RETURNS money
AS
BEGIN
DECLARE @MyPremium MONEY
SET @MyPremium = 0
BEGIN
SET @MyPremium =
CASE @PlanCode
WHEN 'XXX-Mutual' THEN
CASE @CoverageType
WHEN 'F' THEN (@CoverageAmt*0.000098)
WHEN 'I' THEN (@CoverageAmt*0.000068)
END
WHEN 'XXX-Nationwide' THEN
CASE @CoverageType
WHEN 'F' THEN (@CoverageAmt*0.00005)
WHEN 'I' THEN (@CoverageAmt*0.00007)
END
ELSE 0
END
END
IF (@MyPremium IS NULL) SET @MyPremium = 0
RETURN(@MyPremium)
END
Can anyone point me in the right direction?