?
Solved

VB.net report rdlc parameter

Posted on 2009-04-11
14
Medium Priority
?
2,643 Views
Last Modified: 2012-05-06
Is there a way to display a report parameter inside of a rdlc report?
0
Comment
Question by:jimseiwert
[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
  • 9
  • 5
14 Comments
 
LVL 2

Author Comment

by:jimseiwert
ID: 24122797
well let me add more detail. what i am doing is reading a xml file into a datatable. I need to display those fields into the report but I cant seem to get it to work. In the textbox field under dataelementname i provided the column name but when the report displays it is blank. I have confirmed that the datatable has rows with data in them.
0
 
LVL 48

Expert Comment

by:jpaulino
ID: 24125043
What have you done so far ?
Have you already defined the parameter in the report and pass it using LocalReport.SetParameters() method ?
0
 
LVL 2

Author Comment

by:jimseiwert
ID: 24125559
Yes, i just need to display it in the actual report itself
0
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 
LVL 48

Expert Comment

by:jpaulino
ID: 24125828
Ok, then you have the report, the form with the reportviewer and that report defined for the reportviewer. What code are you using to assign the parameters and how are you showing in the report ?
0
 
LVL 2

Author Comment

by:jimseiwert
ID: 24125843
right now I have a textbox field on the report. I want to show the passed parameter (orderNumer) on the textbox
0
 
LVL 48

Accepted Solution

by:
jpaulino earned 2000 total points
ID: 24125870
Then you define the parameters and select the textbox. Right click and choose "Expression" and in the expression box you will find a Parameter category where you can choose the parameter you want.
Finally you just have to use this code:

Dim parameters(0) As ReportParameter
parameters(0) = New ReportParameter("ParameterName", "Value to be showed in the report")
frm.ReportViewer1.LocalReport.SetParameters(parameters)

Open in new window

0
 
LVL 2

Author Comment

by:jimseiwert
ID: 24125948
I did the above steps with the below code. (I replaced and tried your sample)
    Dim report As LocalReport = New LocalReport()
        report.ReportPath = Application.StartupPath & "\Labels\Report2.rdlc"
        Dim parameters(3) As ReportParameter
        parameters(0) = New ReportParameter("Warehouse", "Jim")
        parameters(1) = New ReportParameter("CDate", "Jim")
        parameters(2) = New ReportParameter("OrderNum", "Jim")
        parameters(3) = New ReportParameter("Trans", "Jim")
        report.SetParameters(parameters)

Open in new window

0
 
LVL 2

Author Comment

by:jimseiwert
ID: 24125953
Sorry I did not finish what I was typing, when the report prints all it shows is "Parameters!CDate.Value" w/o the quotes
Dim report As LocalReport = New LocalReport()
report.ReportPath = Application.StartupPath & "\Labels\Report2.rdlc"
Dim parameters(3) As ReportParameter
parameters(0) = New ReportParameter("Warehouse", "Jim")
parameters(1) = New ReportParameter("CDate", "Jim")
parameters(2) = New ReportParameter("OrderNum", "Jim")
parameters(3) = New ReportParameter("Trans", "Jim")
report.SetParameters(parameters)
Export(report)
m_currentPageIndex = 0
Print()

Open in new window

0
 
LVL 48

Expert Comment

by:jpaulino
ID: 24126054
You're trying to print/export the report and does that shows ok for the other things ?
 
0
 
LVL 2

Author Comment

by:jimseiwert
ID: 24126063
All I have is some textboxes that have statis text and that parameters. The static text shows fine.
0
 
LVL 2

Author Comment

by:jimseiwert
ID: 24126100
O have tried to open the report in the reportviewer without printing or exporting and it still displays the same with showing "Parameters!Trans.value

It almost seems as if it is thinking it is a string vs a parameter
0
 
LVL 2

Author Comment

by:jimseiwert
ID: 24126117
I got it, in the expression when I selected the parameter as the value it did not add a equal sign in front of it. Once I added that it worked. Thanks for your help
0
 
LVL 2

Author Closing Comment

by:jimseiwert
ID: 31569209
Note to all others. In the expression don't forget the "=" in front of the parameter
0
 
LVL 48

Expert Comment

by:jpaulino
ID: 24126190
Glad I could help!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

649 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