a

How to display a report parameter label field in a Microsoft Visual Studio Report

Joel Garcia Joel Garcia has been building AllCode since 2015. He’s an innovative, hands-on executive with a proven record of designing, developing, and operating Software-as-a-Service (SaaS), mobile, and desktop solutions. Joel has expertise in HealthTech, VoIP, and cloud-based solutions. Joel has experience scaling multiple start-ups for successful exits to IMS Health and Golden Gate Capital, […]
While working on a client issue today, I ran into an issue when I was trying to display a report label parameter in a Microsoft Visual Studio report.
For this client, we use Microsoft SQL Server Reporting Services to deliver  real-time reports. We leverage the Report Definition Language Client-Side (RDLC ) in Visual Studio to do the client-side reporting.
This client has a number of different facilities. For their reports, they like to filter by facility. In Visual Studio RDLC terms , this means that each report will have a report parameter entitled facid for FacilityID.
Microsoft Visual Studio Report Parameter Properties

Microsoft Visual Studio Report Parameter Properties


This facid will be defined by a DataSet entitled Facilities with the value field set to FacilityID and the label field set to FacilityName.
Microsoft Visual Studio Reporting Parameter Available Values

Microsoft Visual Studio Reporting Parameter Available Values


At the top of the report, we have a label, where we’d like to display the name of the facility selected in the report. For example, for the below report, we’d like to see the number of teams that a certain player has been captain for in 2019 at the facility of Ogden. At the top of the report, I’d like to specify the Facility selected, Ogden, and the Year, 2019.
Microsoft Visual Studio RDLC Report Parameter Label

Microsoft Visual Studio RDLC Report Parameter Label


When I use the Microsoft RDLC syntax to specify the @facid and @year, I get the numeric values, which is fine for the year, but whose going to remember that FacilityID 8 is Ogden.
Microsoft Visual Studio RDLC Label Reporting Parameter Values

Microsoft Visual Studio RDLC Label Reporting Parameter Values


I’d really like the label to display Ogden. Well, it turns out this more complicated than you’d expect. To display the parameter label field for the @facid parameter, we have to use the Lookup function.
First, we need to turn the @facid into a custom expression. By double clicking on the @facid in the label, you should be able to pull up the Placeholder Properties dialog.
Microsoft Visual Studio Placeholder Properties Dialog

Microsoft Visual Studio Placeholder Properties Dialog


By clicking on the fx button, you’ll be taken to the Expression dialog. In the Category view, click on the Common Functions, and select Miscellaneous. On the Item view, click on Lookup.
 
Microsoft Visual Studio Reporting Custom Exoression

Microsoft Visual Studio Reporting Custom Expression


We need to use the Lookup function to retrieve the FacilityName from the Facilities DataSet using the selected parameter facid’s value. How’s that for complicated!
The syntax for the Lookup function is

=Lookup(Fields!SaleProdId.Value, Fields!ProductID.Value,  Fields!Name.Value, "Product")

In plain old english, this syntax states that we’re going to use the SalesProdId as the value to look up the Product Name by matching the ProductID value in the Product DataSet.
Unfortunately, our expression is a little trickier because the report parameter type @facid does not match with the DataSet field datatype for Facilities. We actually have to convert the @facid into a CInt.
Our expression ends up being

=Lookup(CInt(Parameters!facid.Value), Fields!FacilityID.Value, Fields!FacilityName.Value, "Facilities")

When we run the report with this custom expression, we get Ogden in the label. Hey now!

Microsoft Visual Studio Reporting Parameter Label

Microsoft Visual Studio Reporting Parameter Label


Now, the only issue remaining is I have to remember to insert this customer expression into every report where I need to specify the Facility Name. I’ll just refer to this blog post!
AWS Advanced Consulting Partners Learn More
Free AWS Services Template

Download list of all AWS Services PDF

Download our free PDF list of all AWS services. In this list, you will get all of the AWS services in a PDF file that contains  descriptions and links on how to get started.

Joel Garcia

Joel Garcia

Joel Garcia has been building AllCode since 2015. He’s an innovative, hands-on executive with a proven record of designing, developing, and operating Software-as-a-Service (SaaS), mobile, and desktop solutions. Joel has expertise in HealthTech, VoIP, and cloud-based solutions. Joel has experience scaling multiple start-ups for successful exits to IMS Health and Golden Gate Capital, as well as working at mature, industry-leading software companies. He’s held executive engineering positions in San Francisco at TidalWave, LittleCast, Self Health Network, LiveVox acquired by Golden Gate Capital, and Med-Vantage acquired by IMS Health.

Related Articles

AWS Snowflake Data Warehouse Pricing Guide

AWS Snowflake Data Warehouse Pricing Guide

AWS Snowflake Data Warehouse – or just Snowflake – is a data cloud built for users to mobilize, centralize, and process large quantities of data. Regardless of how many sources are connected to Snowflake or the user’s preferred type of organized data used, data is easily stored and controllably shared with selectively-authorized access. Snowflake does offer extensive control over its pricing, though how it works isn’t always clear.

Guide to Cost Factors for Amazon’s RDS Pricing

Guide to Cost Factors for Amazon’s RDS Pricing

Amazon sports a complex pricing model. As simple as the pay-for-what-you-use model sounds, there are several nuances to every service from data used to computing components chosen that can easily let users blow through their entire budget. That’s not to say AWS is an inherently expensive platform and can be adapted to with proper planning and understanding of the contributing factors to billing.

Amazon Elastic Cloud Computing Pricing Guide

Amazon Elastic Cloud Computing Pricing Guide

Amazon Elastic Cloud Computing is the default option for computing on AWS. Outside of outsourced cloud computing options, it is the default service for building, running, and scaling AWS-based applications. As such, EC2 will likely be the main driving force behind AWS bills. Understanding how to control said costs is therefore the most important factor in managing your AWS environment.

Download our 10-Step Cloud Migration ChecklistYou'll get direct access to our full-length guide on Google Docs. From here, you will be able to make a copy, download the content, and share it with your team.