Solved

How to apply filters in crystal report through asp or pass parameter value to stored procedure?

Posted on 2004-03-31
5
188 Views
Last Modified: 2008-03-06
Hi,
I have crystal report 8.0, IE 6.0 and database sql server 2000.
I want to develop the following application.
A crystal report is comming from a table A. Through asp the user can select any column of table and then any values of this column, and these values will be applied to report as filter. Either it can be applied directly to report as filter or pass to stored procedure which can use these values into its where clause or any other easy solution. I need only end result, which is filter the reports data.

Table A
---------------------------
C1       C2       C3
1         alex     600
2         john     200
3         ami      700
4         frank     100
5         fred     500

user can select any column and then value for example he selects
C1(2,3) and C2(alex,john)

Now when user will click on report link and report will bring all data from table A
where c1 in (2,3) and C2(alex,john).

I need very urgent help.
Thanks in advance.
0
Comment
Question by:ala
  • 2
  • 2
5 Comments
 
LVL 13

Accepted Solution

by:
EwaldL earned 500 total points
ID: 10728121
create a multi value parameter which has the same data type as c1. then include this parameter into the record selection formula. i believe the syntax is ic equal icparamter.

do the same for the c2 field.

now you should be able to enter the parameter values (2,3 / alex, john) and the report should show up with only the records that match the criteria.
0
 

Author Comment

by:ala
ID: 10728954
Can you send me code please. I am not  programmer of crystal report.
And aslo please tell me how to call crystal report through asp?
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 10729418
0
 

Author Comment

by:ala
ID: 10732306
Thanks,

I got idea from examples. But now I need first how to passing mulitples values to asp and then how stored procedure will handle it.
I am doing like this:

asp:
NewParamValue = "2,3"
NewParamValue2 = "'john','alex'"

'  Save the new value for the Stored Procedure in the Store Procedure

ThisParam.SetCurrentValue cint(NewParamValue), 7
ThisParam2.SetCurrentValue cint(NewParamValue2), 12

and in stored procedure:

CREATE PROC dbo.GetOrderList1
(
      @C1List varchar(500),@C2List varchar(500)

)
AS
BEGIN
      SET NOCOUNT ON

      DECLARE @SQL varchar(600)

      SET @SQL =
      'SELECT proj_ID, ProjectName, PIN, BUDS
      FROM dbo.actcodes
      WHERE C1 IN (' + @C1List + ') and
                 C2 IN (' + @C2List + ')'

      EXEC(@SQL)      
END
GO

------------------
When I run this stored procedure for number value it works but when i run it for string value it gives me error.
Is it right way I am doing.
If you can give me code or some tips I wil be thankful to you.

Thanks
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 10745990
What error are you getting?

CR 8 is limited to character strings of 254 or shorter.  Your procedure is expecting two 500 character parameters.  I don't think Crystal can do that.

mlmcc
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question