27630 total geeks with 3538 solutions
Recent challengers:
 Welcome, you are an anonymous user! [register] [login] Get a yourname@osix.net email address 

Articles

GEEK

User's box
Username:
Password:

Forgot password?
New account

Shoutbox
kikarskiesher
<br><strong> <a href="http:/ /www.newbala ncecoupons.c om/">new balance 990</a></str ong> <strong ><a href="http:/ /www.newbala ncecoupons.c om/">new balance 373</a></str ong> <br><st rong><a href="http:/ /www.newbala ncecoupons.c om/">new balance sneakers</a> </strong>
kikarskiesher
[b]<a href="http:/ /www.zxxyw.c om/2013-men- 29-c-30.html "<strong><a href="http:/ /www.zxxyw.c om/2013-men- 29-c-30.html ">Sport Mens New Balance</a>< /strong> <br > <strong><a href="http:/ /www.zxxyw.c om/2013-men- 29-c-30.html ">Mens New Balance</a>< /strong> <br >
kikarskiesher
<strong><a href="http:/ /www.zxxyw.c om/">new balance</a>< /strong> | <strong><a href="http:/ /www.zxxyw.c om/">new balance</a>< /strong> | <strong><a href="http:/ /www.zxxyw.c om/">new balance shoes</a></s trong> <br> <title>New Balance A19PB warm-up Black Wh
kikarskiesher
[b][url=http ://www.weddi ngdressesplu ssize.net/be lts-c-329.ht ml]elegance wedding dress belts[/url][ /b] [b][url=http ://www.weddi ngdressesplu ssize.net/be lts-c-329.ht ml]charming wedding dress belts.cheap wedding dress belts[/url][ /b] ty your wedding day, th
kikarskiesher
[b][url=http ://www.nikeu sashoes.com/ ]nike outlet store[/url][ /b] [b][url=http ://www.nikeu sashoes.com/ ]nike running shoes[/url][ /b] [b][url=http ://www.nikeu sashoes.com/ ]nike outlet store[/url][ /b] [b][url=http ://www.nikeu sashoes.com/ ]nike shoes online

Donate
Donate and help us fund new challenges
Donate!
Due Date: Sep 30
September Goal: $40.00
Gross: $0.00
Net Balance: $0.00
Left to go: $40.00
Contributors


News Feeds
The Register
Red Hat unleashes
EL 7.2 beta on a
waiting world
Boffins build
magnetic field
cloak "wormhole",
could help MRI
scanners
Spaniard trousers
?60,000 bank error,
proceeds directly
to jail
Amazon slurps
Elemental
Borg bashes
destabilising DoS
bug in USC kit
Equinix edged
around Wedge, fell
back into
proprietary embrace
NBN vaults
Australia into
global top-10 ?
DDoS attack sources
ACCC hopes to SLASH
rural backhaul
prices
Windows 10 grabbed
about five per cent
market share in
August
Oz public service
reminds staff:
don"t use work
e-mails on "affair"
sites
Slashdot
Another
Neurodegenerative
Disease Linked To a
Prion
Ada Lovelace and
Her Legacy
Pioneer Looks To
Laserdisc Tech For
Low-Cost LIDAR
Copenhagen"s New
All-Electric Public
Carsharing
Programming
Congressional
Testimony: A
Surprising
Consensus On
Climate
Connecting the
Unwired World With
Balloons,
Satellites, Lasers
& Drones
Easy-To-Clean
Membrane Separates
Oil From Water
14-Year-Old Boy
Placed On Police
Register After
Sending Naked
Picture To
Classmate
Completely
Paralyzed Man Walks
In Robotic
Exoskeleton
Slowing Wind Energy
Production Suffers
From Lack of Wind
Article viewer

List parameters from an SSRS (SQL Server Reporting Services) report into an expression.



Written by:bb
Published by:bb
Published on:2006-10-24 07:55:46
Topic:Dot.Net
Search OSI about Dot.Net.More articles by bb.
 viewed 25775 times send this article printer friendly

Digg this!
    Rate this article :
How to get a list of parameters and their values from an SSRS (SQL Server Reporting Services) report from within an expression of the report. Its a nice way to echo out all parameters a report was run with without having to hardcode and means you can implement standard footers easily.

I found some tips for doing this on James Kovacs' Weblog. But the code wasnt there, so here it is if you wish to implement it. Another useful msdn article is here.

I am using the imported DLL mechanism of writing code for reports (rather than the inline Code section) Simply add this method to an assembly and reference it in your report. Remember to copy the dll to "C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\" to test it when previewing from Visual Studio.

To call this function put a TextBox on your report, edit the expression and add the line
=YourDll.DisplayParams(Parameters, "Param1, Param2");


The function for the assembly
using Microsoft.ReportingServices.ReportProcessing.ReportObjectModel;

///
/// Builds a list of SQL Server Reporting Services Parameters based on a parameter object
/// and a comma delimited string of param names
///
public static string DisplayParams(Parameters obj, string strParams)
{
    StringBuilder sbRet = new StringBuilder();
    try
    {
        //parameters in comma delimited list which matches
        //the name of the parameter in the collection.
        foreach (string sParam in strParams.Split(','))
        {
            //the name of the parameter
            sbRet.Append(String.Format("{0}: ", sParam));

            //concat parmaeter values
            if (obj[sParam].IsMultiValue)
                for (int i = 0; i < obj[sParam].Count - 1; i++)
                    sbRet.Append(String.Format("{0} : ",
                            ((string[])obj[sParam].Label)[i]).Trim());
            else
                sbRet.Append(String.Format("{0}", obj[sParam].Label).Trim());

            //remove any trailing commas
            if (sbRet.ToString().EndsWith(", "))
                sbRet.Remove(sbRet.Length - 2, 2);

                        // seperator for each parameter
                        sbRet.Append("; ");
        }
    }
    catch (Exception)
    {
        return "Error building parameter list";
    }

    return sbRet.ToString();
}

Did you like this article? There are hundreds more.

Comments:
<none>
Anonymously add a comment: (or register here)
(registration is really fast and we send you no spam)
BB Code is enabled.
Captcha Number:


Blogs: (People who have posted blogs on this subject..)
bb
ASP.NET RadioButton GroupName when inside a Repeater on Sun 10th Jun 8am
I was thankful on finding this nugget of code, which makes the groupname work out when slamming in radiobuttons in an asp.net repeater. http://www.codeguru.com/csharp/csharp/cs _controls/custom/article.php/c12371/


     
Your Ad Here
 
Copyright Open Source Institute, 2006