Report Design
 Crystal Reports Forum : Crystal Reports .NET 2003 : Report Design
Message Icon Topic: struggling with dataset and report viewer Post Reply Post New Topic
Author Message
shama144
Newbie
Newbie
Avatar

Joined: 15 May 2008
Location: United States
Online Status: Offline
Posts: 2
Quote shama144 Replybullet Topic: struggling with dataset and report viewer
    Posted: 15 May 2008 at 7:48am
I"ve got a simple dataset (ds2) with 4 fields and need to be able to show in the report viewer. I had been using a report and since I could never get the dataset to push the data over (ie,
 
Dim report as new crReport
 
report.setdatasource(ds2)
crvReport.reportsource=report
 
I have confirmed the dataset has actual good data in it but it won't put it in the report.
I have since tried to change my thinking to creating the viewer by scratch with the data in the dataset (ds2) but I'm quickly getting nowhere. I'm plagued by the meaning of terms I'm not familiar with, like a 'discretevalue' What is that?
 
Right now I have the following code:
 

'just checks to see if the dataset has anything in it

If ds2.Tables(0).Rows.Count > 0 Then

'This is supposed to fill the crystal report viewer

Dim pfield As New ParameterField

Dim pfields As New ParameterFields

Dim disval As New ParameterDiscreteValue

pfield.ParameterFieldName = "Part Number"

pfields.Add(pfield)

pfield.ParameterFieldName = "Description"

pfields.Add(pfield)

pfield.ParameterFieldName = "Price"

pfields.Add(pfield)

pfield.ParameterFieldName = "Sold Status"

pfields.Add(pfield)

crvCompareInvent.ParameterFieldInfo = pfields

For i = 0 To ds2.Tables(0).Rows.Count - 1

       

pfields.Item("Part Number").CurrentValues.Add(ds2.Tables(0).Rows(i).Item("PartNumber").ToString)

pfields.Item("Description").CurrentValues.Add(ds2.Tables(0).Rows(i).Item("Partdescription").ToString)

pfields.Item("Price").CurrentValues.Add(ds2.Tables(0).Rows(i).Item("PartPrice").ToString)

pfields.Item("Sold Status").CurrentValues.Add(ds2.Tables(0).Rows(i).Item("SoldStatus").ToString)

 Next

I can't figure out how to fill the report viewer with info... I know this sounds pitiful but if you would, Please assist.
 
Thanks in advance
Wayne
 


Edited by shama144 - 15 May 2008 at 8:03am
Things are only impossible that you can't find someone else to do it for you
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 15 May 2008 at 10:38am
DiscreteValue is a single value - this is as opposed to RangeValue which represents two values in a from-to relationship.
 
-Dell
IP IP Logged
shama144
Newbie
Newbie
Avatar

Joined: 15 May 2008
Location: United States
Online Status: Offline
Posts: 2
Quote shama144 Replybullet Posted: 15 May 2008 at 11:29am

That's good to know. Thank you

That just leaves the main problem to wrestle with. Putting data from a run-time dataset into a CR viewer. there is no report created previously. It's a dataset that was modified to incude only certain information from the original dataset that was altered based on partnumbers from a text file. This new dataset then needs to push it's info into the reportviewer but I can't get the report to pull from this 'on-the-fly' dataset.
 
I have created an XML file that is written and then the data pulled from that and that seems to work but this seems primitive and could possibly cause undesireable affects.
Thanks
Things are only impossible that you can't find someone else to do it for you
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 15 May 2008 at 12:23pm
I have not had any problems getting reports to read from DataSets.  (I generally do this in WinForms utility programs written in C#.)  Here is the process I use:
 
Given two forms - one for generating the data (Data Form) and one for viewing the report (Viewer Form).
 
1.  In the Data Form, fill the DataSet.
2.  In the Data Form, create an instance of the Viewer Form.
3.  From the Data Form, call a public method in the Viewer Form to Configure the report.  This method takes a DataSet as an input parameter.
4.  In the Configure method of the Viewer Form, create an instance of the report, set the data source of the report to the DataSet parameter, set the ReportSource of the viewer to the report.
5.  From the Data Form, show the Viewer Form.
 
You can modify this process to fit your needs.  The important part that MUST be done in this order is:
 
1.  Generate the data.
2.  Set the DataSource for the report.
3.  Set the ReportSource for the viewer.
 
-Dell
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.