Note that there are some explanatory texts on larger screens.

plurals
  1. POCrystal Reports XI and MySQL Stored Procedure with Parameters
    primarykey
    data
    text
    <p>I am having a problem with a Crystal Report that displays data from a MySQL table. I am currently gathering the data directly from the table, however when the users try to input parameters, problems arise such as:</p> <ol> <li>null values for parameters returning errors</li> <li>parameters not working as specified</li> </ol> <p>I then created a stored procedure to return data if a parameter is empty and will make the MySQL server do the work rather than the Crystal Reports server. </p> <p>However Crystal Reports doesn't appear to recognize this and I am having some trouble displaying the results of the procedure.</p> <p>Here is a copy of the procedure i am using:</p> <pre><code>Create Procedure sp_report (IN @param1 varchar(64), IN @param2 varchar(64), IN @param3 int ) Begin IF @param1 is null AND @param2 is null AND @param3 is null Then Select * from tblData ELSE IF @param1 is null AND @param2 is not null AND @param3 is not null then Select * from tblData where field3 = @param3 and field2 = @param2 ELSE IF @param1 is not null AND @param2 is not null AND @param3 is null then Select * from tblData where field2 = @param2 and field1 = @param1 ELSE IF @param1 is not null AND @param2 is null AND @param3 is not null then Select * from tblData where field3 = @param3 and field1 = @param1 ELSE IF @param1 is not null AND @param2 is null AND @param3 is null then Select * from tblData where field1 = @param1 ELSE IF @param1 is null AND @param2 is not null AND @param3 is null then Select * from tblData where field2 = @param2 ELSE IF @param1 is null AND @param2 is null AND @param3 is not null then Select * from tblData where field3 = @param3 ELSE IF @param1 is not null AND @param2 is not null AND @param3 is not null then Select * from tblData where field3 = @param3 and field2 = @param2 and field1 = @param1 END; </code></pre> <p>Is there an easier way to do this or am I doing something wrong? Any suggestions would be greatly appreciated.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload