Ticket T288742
Visible to All Users

How to select all data when no selection is made for XtraReports multi value parameter

created 9 years ago

Hi,

I am currently having trouble passing "all" multi value parameter to my report

Below is my VB code and i am also attaching my report configuration

param1.Name = "parSvcType"
        param1.Type = GetType(System.String)
        param1.MultiValue = True
        param1.Value = New String() {""}
        param1.Visible = False
        report.Parameters.Add(param1)
        report.RequestParameters = False
        ASPxDocumentViewer1.Report = report
        ASPxDocumentViewer1.ReportTypeName = "rep_bycategory"

If user did not select any category i would like it to show all the data in the database. How can I achieve this ?

Thanks again for the assistance.

Rgds,
Andrew

Answers approved by DevExpress Support

created 8 years ago (modified 8 years ago)

More clear way not to filter by multivalue parameter if nothing is selected this will be to:

  1. crate a custom function that receives the multivalue parameter and returns it's length (it will just cast it's parameter to array and return Length property)
  2. create a calculated field that uses this function with expression (CustomLenFunction([MultivalueParameter]) <= 0) OR ([FieldToFilterOn] In ([MultivalueParameter]))
  3. check for this calculated field to = true in format string
    created 9 years ago (modified 8 years ago)

    Hi Andrew,

    Currently, there is no default "Select All" item in multi-value Parameters. You need to implement this manually. An optimal solution is to customize the XtraReport's FilterString property in the XtraReport.DataSourceDemanded  or XtraReport.BeforePrint event handler (or script handler) based on the current Parameter value. For example, if there are no elements in the Parameter.Value property, exclude the corresponding condition from FilterString. Otherwise, add it.

    See also:
    Optional Parameters for reports

      Show previous comments (3)
      Vasily (DevExpress Support) 9 years ago

        You are always welcome, Andrew! I am happy to hear that our support was helpful.

        AS AS
        Andre Steffens 2 9 years ago

          In my case the Value property of the StaticListLookUpSettings turned out to be List(Of Object)
          So my code to extract the selected values for the parameter was:

          Visual Basic
          Dim selectedSections As IEnumerable(Of String) = CType(Me.SectionFilter.Value, IEnumerable(Of Object)).Cast(Of String)

          Vasily (DevExpress Support) 9 years ago

            Thank you for sharing your solution, Andre!

            Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

            Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.