Crystal Reports w/ASP.NET

James

Well-known member
Joined
Oct 3, 2002
Messages
78
Hi all,

I am having trouble creating a report to display properly in my web app.

I created a report that has 3 parameters:
twp
wbs
wp

I created a connection to a database and place the twp, wbs and wp fields in the detail section.

I created a .aspx web form with with a CrystalReportViewer control that binds to the report.

In my report I used the Select Expert to assign the fields to "is equal to" for each field and parameter.

The user interacts with the report by selecting from dropdown boxes named ddTWP, ddWBS and ddWP.

My code passes the parameters to the report and displays the record only if all the parameters have values. What I dont know how to do is check to see if a parameter has a value. If it does I want to build the where clause dynamically with the parameter that has a value and not use the parameters that dont have values. Then retrieve the records based off the dynamic query.

I am new to Crystal Reports and dont know how to retrieve specific records. All I know how to use is the Select Expert which does not seem to do what I want.

Please help,

James
 
I would recommend passing all 3 parameters to the report. Then work out which parameters are valid within the Selection Expert.

If you have a reasonable knowledge of VB then go to the Select Expert and click Show Formula, then Formula Editor. In here you can use either the Crystal Syntax, or probably more useful, is Basic Syntax. From here it is simple logic procedures to decide which parameters you should apply the filters by.

For Example:
Code:
if not (length({?cost code}) = 4) then
    {gsp_POView.COST_CENTRE} = {?cost centre}and
{gsp_POView.DATE_CREATED} = {?date}
else
    {gsp_POView.COST_CENTRE} = {?cost centre} and
    {gsp_POView.COST_CODE} = {?cost code} and
    {gsp_POView.DATE_CREATED} = {?date}
 
Back
Top