Click here to Skip to main content
15,885,954 members
Articles / Database Development / SQL Server

How to Select What Fields to Display on a Report from a Multi-value

Rate me:
Please Sign up or sign in to vote.
2.71/5 (4 votes)
16 Mar 2008CPOL 26.6K   18   2
How to select what fields to display on a report from a multi-value

Introduction

Sometimes, clients want to select which fields need to be displayed in the report. SSRS can provide this function through multi-value parameter and custom code.

  1. Add a multi-value parameter including all the fields that need to be selected.

1.JPG

  1. Add a custom function. This function is used to find if the specified field is selected.

    2.JPG

  2. The source code is as follows:

    VB.NET
    public function CheckSelect(byval s1 as integer) as boolean
    CheckSelect=false
    dim i as integer
    i=0
    for i=0 to Report.Parameters!Report_Parameter_0.count()-1 step 1
    if s1=Report.Parameters!Report_Parameter_0.Value(i) then CheckSelect=true
    next i
    end function
  3. Set the expression of column’s visibility property as “=Not Code.CheckSelect(0)”.

History

  • 17th March, 2008: Initial post

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
China China
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
QuestionWhy so complicated? Pin
interfernet9-Feb-09 0:31
interfernet9-Feb-09 0:31 
AnswerRe: Why so complicated? Pin
pengyi20-Sep-09 3:46
pengyi20-Sep-09 3:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.