473,406 Members | 2,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Crystal report.net discrete parameter


I'm having a problem with Crystal report.net with ASP.NET.
The problem occurs when exporting the report. The report
uses a discrete parameter with multiple values. When the
report is loaded into the crystal report view it shows all
the values from the discrete parameter. But when I export the
report it only shows the values from the last discrete parameter value
enter.
My code is listed below:
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()

' Start Loading Report
'CR(Variables)
Dim opTeam As String()
Dim crParameterValues As New ParameterValues
Dim crParameterFieldDefinitions As ParameterFieldDefinitions
Dim crParameterFieldLocation As ParameterFieldDefinition

Dim paramFields As New ParameterFields
Dim paramField As New ParameterField
Dim discreteVal As New ParameterDiscreteValue
Dim rangeVal As New ParameterRangeValue

CrystalReportViewer1.Visible = True
crReportDocument.Load(Server.MapPath("CrystalRepor t1.rpt"))
crReportDocument.SetDatabaseLogon("****", "****")

Dim t As System.Web.UI.WebControls.ListBox

If Session("ListBox2") Is Nothing Then
t = New ListBox
't.Item(0).Text = "All"
Else
t = Session("ListBox2")
End If

Dim ind As Integer
Dim CRdiscretevalue As New
CrystalDecisions.Shared.ParameterDiscreteValue

crParameterFieldDefinitions =
crReportDocument.DataDefinition.ParameterFields
crParameterFieldLocation =
crParameterFieldDefinitions.Item("Operator Team")
crParameterValues = crParameterFieldLocation.CurrentValues
paramField.ParameterFieldName = "Operator Team"

Dim paramDiscreteValue As ParameterDiscreteValue
paramDiscreteValue = New ParameterDiscreteValue
If t.Items.Count 0 Then
For ind = 0 To t.Items.Count - 1
paramField.ParameterFieldName = "Operator Team"
discreteVal = New ParameterDiscreteValue
discreteVal.Value = t.Items(ind).Text
paramField.CurrentValues.Add(discreteVal)
Next
Else
paramField.ParameterFieldName = "Operator Team"
discreteVal = New ParameterDiscreteValue
discreteVal.Value = "All"
paramField.CurrentValues.Add(discreteVal)
End If

paramFields.Add(paramField)

crReportDocument.SetParameterValue("Operator Team",
discreteVal)
'Bind the report to the viewer

CrystalReportViewer1.ReportSource = crReportDocument
CrystalReportViewer1.ParameterFieldInfo = paramFields
CrystalReportViewer1.DataBind()
' End Loading Report

'Export Code
oStream = crReportDocument.ExportToStream( _

CrystalDecisions.Shared.ExportFormatType.PortableD ocFormat)

With Response
.ClearContent()
.ClearHeaders()
.Buffer = True
.ContentType = "application/pdf"
.AddHeader("Content-Disposition", "inline;
filename=Report.pdf")
.BinaryWrite(oStream.ToArray())
.End()
End With

Sep 20 '06 #1
0 1787

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: PK | last post by:
Hi, I have an application that opens a Crystal report document and passes in a value to a parameter in the report (pointing to an Oracle DB). However, if I want to pass a "null" value to retrieve...
0
by: John F | last post by:
Hi, If there is a more appropriate group for this, please point me in the right direction. I have a Crystal Report .rpt file that I can get to launch from my code and I can view it. I pass...
0
by: Dean Sabella | last post by:
Hi, I was trying to run a crystal report in the .net sample application given at: http://support.crystaldecisions.com/communityCS/FilesAndUpdates/ cppnet_win_subreport_basic.exe.asp (I've...
2
by: drisso | last post by:
Hello, I have searched that error on these message boards, msdn and crystaldecisions.com. I found tutorials that showed how to export a crystal report to pdf, but like many others I am getting...
0
by: Henry | last post by:
I have written an ASP/VB.Net application via VS 2003 (Crystal V9) that uses MS Access 2000 as its database. I can export reports that have no linked sub reports for printing. However, I'm unable...
0
by: Alison Givens | last post by:
Hi all, I have been suffering with this problem for weeks now. I tried several newsgroups, but nobody can tell me how to solve this problem. The problem: I have a webform that shows a Crystal...
1
by: Hardy Wang | last post by:
Hi all, I have a piece of code in my C# console application to export from crystal report files to PDF. For some reports files, I get errors below. I have Crystal Reports 8.5 with service pack...
0
by: lrobo01 | last post by:
I'm having a problem with Crystal report.net with ASP.NET. The problem occurs when exporting the report. The report uses a discrete parameter with multiple values. When the report is loaded into...
0
by: paul | last post by:
Hello, I have recently upgraded to VB .net 2005 and a Crystal report that before did not use to prompt for its single parameter now does so. I have been writing the parameter value to the report...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.