I am trying to use a MySQL Stored Procedure in a Scriptcase form. I have two fields; ‘RecipeTitle’ and ‘Variant’. IF when adding a NEW recipe the ‘RecipeTitle’ is the same then the ‘Variant’ field which is an integer indicates the number of like 'RecipeTitle’s there are,
For Example:
If I have a Recipe called “Sam” and there is only one occurrence in the database then the Variant is 1.
RecipeTitle Variant
Sam 1
If there were two recipes called “Sam” then there would be two records with Variant 1 and 2 respectively.
RecipeTitle Variant
Sam 1
Sam 2
…
So in the case of wanting to count how many RecipeTitle records there are I need to have one IN parameter and one OUT parameter to receive the total. Would this assumption be correct??
Given the above I created an AJAX OnFocus for Variant field with the following code:
sc_lookup(rsData, “CALL stProc_RecipeVariantCount(’{RecipeTitle}’)”,“conn_mysql_dbrecipedirectory”);
{Variant} = {rsData[0][0]};
Notice that the field ‘RecipeTitle’ is the IN parameter.
I get no results which makes me think I have something wrong in Scriptcase for how I am calling the Stored Procedure. The Stored Procedure works perfectly in MySQL. See below:
BEGIN
SELECT
COUNT(RecipeTitle) INTO iResult
FROM tblrecipecatalog
WHERE
(RecipeTitle = sRecipeTitle);
END
IN sReciptTitle VARCHAR(60)
OUT iResult INT(3)
Would someone mind helping me re-write the above code in Scriptcase to return the correct number of RecipeTitle’s in the table. Thank you so much!