Solved

Parameters in Crystal Reports 9 through VS.Net 2003

Posted on 2004-03-25
2
1,149 Views
Last Modified: 2012-05-04
I am trying to set parameters correctly in an ASP.Net page for a crystal report but keep getting the message: Missing parameter field current value. Here is my current code:

CRV1.ReportSource = myReport
Dim ParameterFields As ParameterFields
ParameterFields = CRV1.ParameterFieldInfo
If Session.Item("Parm") <> "" Then
    Dim strParmName As String, strParmVal As String
    strParmName = Session.Item("ParmName")
    strParmVal = Session.Item("Parm")
    myReport.SetParameterValue(0, strParmVal)
Else
    Dim ParameterField As ParameterField
    ParameterField = ParameterFields.Item(0)
    If myReport.DataDefinition.ParameterFields(0).DefaultValues.Count > 0 Then
        ParameterField.CurrentValues = ParameterField.DefaultValues
    Else
        ParameterField.EnableNullValue = True
    End If
End If

Neither the Default nor the EnableNullValue seem to work.  What am I doing wrong - I can't seem to find any documentation on this for crystal 9.
0
Comment
Question by:pmcgivern
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 4

Accepted Solution

by:
stasau earned 250 total points
ID: 10677197
You still need to set the Parameter Value to NULL after you enable it to be null.  So the end of your if statement should look like:

    Else
        ParameterField.EnableNullValue = True
       myreport.SetParameterValue(0, vbNullString)
    End If

You could also create a ParameterValues object and set its value to null and add that to the ParameterField.CurrentValues collection but this is easier.
0
 
LVL 2

Author Comment

by:pmcgivern
ID: 10677392
Excellent - that works now for the nulls.  
Fixed the defaults problem too :
ParameterField.CurrentValues = ParameterField.DefaultValues

should be:

myReport.SetParameterValue(0, ParameterField.DefaultValues.Item(0))

Thanks.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

734 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