Showing posts with label rdlc. Show all posts
Showing posts with label rdlc. Show all posts

Monday, March 19, 2012

.rdlc table use of SUM and SWITCH together?

Hello everyone, thanks in advance for reading. I'm new to reports and have tried searching for my answer with no luck. Any direction would be great.

Here is the issue, I have 3 colums in the dataset which display String data ("High", "Medium", or "Low")

I've added a column to the table on the report where I would like to convert the value of "High", "Medium" and "Low" to 3,2,1 respectively then SUM these numbers.

Is this possible? I've tried several variations of the code below--maybe it's not possible to do what I want? Thanks again for your time and help.

Fields!PP.Value is set to:

=Switch(Fields!Avail_Rank.Value = "High", 3, Fields!Avail_Rank.Value = "Medium", 2, Fields!Avail_Rank.Value = "Low", 1)

=Switch(Fields!Volume.Value = "High", 3, Fields!Volume.Value = "Medium", 2, Fields!Volume.Value = "Low", 1)

=Switch(Fields!Integ_Rank.Value = "High", 3, Fields!Integ_Rank.Value = "Medium", 2, Fields!Integ_Rank.Value = "Low", 1)

=Sum(Fields!Avail_Rank.Value + Fields!Volume.Value + Fields!Integ_Rank)

One way of doing this is to define calculated fields on your dataset.

For example, define a calculated field called Avail_Rank_Numeric with the value expression: =Switch(Fields!Avail_Rank.Value = "High", 3, Fields!Avail_Rank.Value = "Medium", 2, Fields!Avail_Rank.Value = "Low", 1)

Then, in the Sum aggregate function in the report body use it as follows:
=Sum(Fields!Avail_Rank_Numeric.Value + ...)

-- Robert

|||Thank you very much! Your idea worked perfectly!

Sunday, March 11, 2012

.rdlc reports - add values through textbox name?

hi all

have a .rdlc report like an invoice.

how can i add the values in my textboxes by the Name property of the Text Box.

like txtSubTotal.Text + txtTax.Text + txtShipping.Text. ?

all those fields are populated with calculations that run on the dataset and all have values. I just cant seem to write the proper syntax to add by control names, rather than field names.

well youshould use this syntax

ReportItems!txtSubTotal.Value + ReportItems!txtTax.Value + ReportItems!txtShipping.Value

NB: this wouldn't work whih agregiate functions unless used in a header or footer

Hope this help

|||

Yes I couldn't for the LIFE OF ME find any information on the

ReportItems! < identifier. AFter much searching i found it buried in a MSDN doc somewhere called "The 5 Elements of a Microsoft Report"

Anyways got it working fine now.

thanks,

mcm

|||

hi

Please tell me how to add Runtime value into Report.rdlc. I have two date(for start & end date) Controls on web page. I want to display those date on Report.rdlc using c#.

thanking you in advance

|||

here is a code fragment that could help you :

List<ReportParameter> par=new List<ReportParameter>();ReportParameter p=newReportParameter("saleid","43660");par.Add(p);this.reportViewer1.ServerReport.SetParameters(par);this.reportViewer1.RefreshReport();
Hope this helps

.RDLC report & getting pdf export in landscape

Hello,

.RDLC reports are driving me nuts... I've a report of which i've set dimensions to 29,7 cm width and 21 cm height. When I view the report in a reportviewer, everything looks cool and ok. When I export the report to PDF I get 2 A4 pages in portrait. How can I make the reportviewer export to PDF in LANDSCAPE?

Dieter

Ensure that you set the dimension onreport properties, notbody properties.

Regards,
Jess

|||

Go to the Report Properties and set the page width: 11in and Page height: 8.5 in

And your Body Width should be Page Width – (Left Margin + Right Margin). Make sure no control

On the Header Footer extends this width.

If you click Print and see if the orientation set to the "Landscape" if it is then it will be exported to PDF

in Landscape.

|||Thx Jess, that was the correct tip for me ... Silly mistake, silly me :)