?
Solved

Crystal Report is printing blank fields

Posted on 2010-08-29
14
Medium Priority
?
774 Views
Last Modified: 2012-05-10
I am trying to print a dataset into a crystal report. Attached is my code.
I could print the dataset into a text file for test purpose. So, the dataset is not empty.
The report has the database fields corresponding to the dataset columns. I am dragging and dropping those database fields into the report (details section).

The report is generating and printing all the hard coded values and table row heading but the table row values are blank. Can there  be a possible reason for that? What am I missing?
Dim rptDoc As ReportDocument
        rptDoc = New myReport

	MyDataSet.WriteXml("C:\Dataset.txt")
        
        rptDoc.SetDatabaseLogon(DBLoginID, DBPassword, DBServer, DBName)
        rptDoc.SetDataSource(MyDataSet)
	

        Dim pardefn As CrystalDecisions.crystalreports.engine.ParameterFieldDefinition
        Dim parval As CrystalDecisions.shared.ParameterValues
        Dim pardval As CrystalDecisions.shared.ParameterDiscreteValue

        pardefn = rptDoc.DataDefinition.ParameterFields("columnid")
        parval = New CrystalDecisions.shared.ParameterValues
        pardval = New CrystalDecisions.shared.ParameterDiscreteValue
        pardval.Value = CInt(Trim(Session("colid")))

        parval.Add(pardval)
        pardefn.ApplyCurrentValues(parval)

   
        CrystalReportViewer1.ReportSource = rptDoc

Open in new window

0
Comment
Question by:Angel02
[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
  • 5
  • 5
  • 4
14 Comments
 
LVL 11

Expert Comment

by:tickett
ID: 33560842
Just to be sure. Do you have anything in the selection criteria? (i.e. your dataset might be being passed correctly but the records may all be filtered out by selection criteria).

L
0
 

Author Comment

by:Angel02
ID: 33560881
Sorry, what do you exactly mean by selection criteria? like if I am using anyhting in the sql query ?
0
 
LVL 11

Assisted Solution

by:tickett
tickett earned 400 total points
ID: 33560919
Well, say your dataset has 100 rows but your report is set to only show rows where column1 = 10 (and if no records match the criteria that would explain why nothing is being displayed).

I can see you are passing a parameter which is what leads me to believe you may be using that to filter your dataset in the crystal report?

L
0
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

 

Author Comment

by:Angel02
ID: 33561100
I am pulling 2 rows from the database. Those two rows are obtained in my test text file.
I am not doing any filtering after that.

BUT....
I have copied my report from an existing report and I am making changes to it. So the report has this parameter file "columnid". It is not letting me delete it from the field explorer as it is bounded to the report. But I cannot find it on the .rpt either. I don't know what this field is doing. Is there a way I can delete it, or find out what its doing? Can this field be making my dataset blank?
0
 
LVL 16

Expert Comment

by:13598
ID: 33561119

Try this before setting your reportviewer reportsource and let me know what you get (you only have one parm right?):


for i as Integer = 0 to  rptDoc.DataDefinition.ParameterFields.count
   If String.Compare(rptDoc.DataDefinition.ParameterFields(i).Name, "columnid", True) = 0 Then
messagebox.show("Good Parmname")
else
messagebox.show(rptDoc.DataDefinition.ParameterFields(i).Name.tostring )
end if
next
messagebox.show(CInt(Trim(Session("colid")))  )

CrystalReportViewer1.ReportSource = rptDoc
0
 
LVL 11

Expert Comment

by:tickett
ID: 33561134
Can you attach the report? In Crystal Reports you can right click and field in and click something like "find in report" and it will show you where it is used.

L
0
 

Author Comment

by:Angel02
ID: 33561823
@13598
This is what printed for the attached code
Good Parmname(0)
colID: 713  
What does this mean?

@tickett
What do I right click? I cannot 'see' the field "columnid"  on the report. I just see it checked in the filed explorer which tells me that it is added in the report. Is it hidden ?
For i As Integer = 0 To rptDoc.DataDefinition.ParameterFields.Count - 1
            If String.Compare(rptDoc.DataDefinition.ParameterFields(i).Name, "columnid", True) = 0 Then
                messagebox.show("Good Parmname(" + i.ToString + ")")
            Else
                messagebox.show("ParaName: " + rptDoc.DataDefinition.ParameterFields(i).Name.ToString)
            End If
        Next
       messagebox.show(CInt(Trim(Session("colid")))  )


        CrystalReportViewer1.ReportSource = rptDoc

Open in new window

0
 
LVL 11

Expert Comment

by:tickett
ID: 33561844
Right click it in the field explorer. If you don't see the option you need to install some services packs.
L
0
 
LVL 11

Expert Comment

by:tickett
ID: 33561846
Or post the report here and I'll look for you :)
0
 
LVL 16

Expert Comment

by:13598
ID: 33561905
If you select your crystal report in designer do you see on the top bar File, Edit, View......Crystal Reports...?
Click on the Crystal Reports menu, Reports, Selection Formula.
What do you have here? Are you using the columnid there?
If you are, delete it and then you will be able to delete the parameter.
0
 
LVL 16

Expert Comment

by:13598
ID: 33561987
This is what printed for the attached code
Good Parmname(0)
colID: 713  
What does this mean?

That means that the parameter name is spelled correctly and that you are passing it a value. I posted that before I saw your post regarding the columnid. I thought that was how you were selecting the data but either the parameter name or the parameter value were incorrect.
After your post regarding that field, the reason why you don't get any data is because you are running the report based on the columnid being 713 but it appears that your dataset is not supposed to have any parameters????  Those two rows that you pull in your dataset do they even have a columnid and if they do is it 713?
0
 

Author Comment

by:Angel02
ID: 33562006
Sounds good. Thanks !
Attached is the .rpt. The field you need to look for is "estid".
repRpt.rpt
0
 
LVL 16

Accepted Solution

by:
13598 earned 1600 total points
ID: 33562085
Click on the Crystal Reports menu, Reports, Selection Formula.
Your selection formula is using that field:
{DSNHRpt.catID}=2 and {DSNHRpt.intestab_id}={?estID}
change your formula to what you need.
0
 

Author Comment

by:Angel02
ID: 33562275
wowww.. dat worked !!
I was missing that selection formula all these days. Never looked at it.
Deleting that entire formula printed my dataset as it is :)

Amazing.. thank you guys ! I wish I could give you few thousands points each :)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone 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

by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

777 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