Type own list of parameter values

12 posts, 1 answers
  1. Dwight
    Dwight avatar
    27 posts
    Member since:
    Aug 2011

    Posted 24 Oct 2011 Link to this post

    Hi

    Moving from ssrs to Telerik reporting I am finding it mostly easy to understand and the transition reasonably smooth but one thing I cant work out after much searching and experimenting is how to supply a list of values to use as a parameter selection for the end user without having to use a datasource

    Many of the parameters I will be using in my reports simply require the values

    Yes
    No

    or

    Not started 
    In progress
    Complete

    In ssrs is was easy to use the report parameters dialog to type in the 
    text value pairs but i cant find that functionality in the parameter collection dialog in Telerik reporting

    I would appreciate if anyone can assist as I would prefer not to have to make a table for each parameter value

    Regards

    Dwight

  2. Answer
    Peter
    Admin
    Peter avatar
    1611 posts

    Posted 26 Oct 2011 Link to this post

    Hello Dwight,

    You have two options:
    • add an user function as the following one, for AvailableValues.DataSource set up ObjectDataSouce, select the user function as data member and define the datasource parameter values:
      public static object[] ConvertCommaSeparateStringToArray(string value)
      {
          return value.Split(',');
      }
    • set up the report parameters available values directly in the report's constructor as shown in the following code snippet:
      public Report1()
      {
          //
          // Required for telerik Reporting designer support
          //
          InitializeComponent();
          this.ReportParameters["Parameter2"].AvailableValues.DataSource =
              new object[] { "Not started", "In progress", "Completed" };
      }
    I have attached a sample report to illustrate both of the approaches.

    Kind regards,
    Peter
    the Telerik team

    Q2’11 SP1 of Telerik Reporting is available for download (see what's new). Get it today.

  3. DevCraft banner
  4. Dwight
    Dwight avatar
    27 posts
    Member since:
    Aug 2011

    Posted 27 Oct 2011 Link to this post

    Thx very much, thats fantastic Peter

    I will convert the code to vb and im sure the second option looks easiest for me to implement

    Much appreciated
  5. derek
    derek avatar
    7 posts
    Member since:
    Nov 2012

    Posted 09 Jan 2013 Link to this post

    In case anyone else runs across this, you can also put:

    this.ReportParameters["transactionTypeCode"].AvailableValues.DataSource =
         new object[] { new { Text = "All", Value = "_" }, new { Text = "Credit", Value = "C" }, new { Text = "Debit", Value = "D" } };

    Then assign DisplayMember to Text and ValueMember to Value in the ReportParameter Collection Editor.

    In this case I also get creative with the query so I can display credits, debits or both.  The WHERE clause has:
    AND CASE @transactionTypeCode WHEN '_' THEN '_' ELSE x.TransactionTypeCode END = @transactionTypeCode


  6. Harika
    Harika avatar
    9 posts
    Member since:
    Apr 2014

    Posted 25 Apr 2014 in reply to derek Link to this post

    Hello Peter,

    I tried to implement the solution you proposed in mine and it displayed empty values in the drop down .


    public StateReports()
    {
    //
    // Required for telerik Reporting designer support
    //
    InitializeComponent();
    this.ReportParameters["HelloString"].AvailableValues.DataSource = new object[] { "All State Cases", "Non-UNISYS Only", "UNISYS Only" };
    }

    It displayed no value in the drop down and gave me an undescriptive error "Missing or invalid parameter value. Please input valid data for all parameters".

    Not Sure where I went wrong. "HelloString" is the name of my parameter and I have bound the DisplayMember and ValueMember properties to = Parameters.HelloString.Value

    I am not sure where I am going wrong and would appreciate your suggestions:

    Thanks for your time in advance !
  7. Harika
    Harika avatar
    9 posts
    Member since:
    Apr 2014

    Posted 25 Apr 2014 in reply to Peter Link to this post

    Hello Peter,

    I tried to implement the solution you proposed in mine and it displayed empty values in the drop down .


    public StateReports()
    {
    //
    // Required for telerik Reporting designer support
    //
    InitializeComponent();
    this.ReportParameters["HelloString"].AvailableValues.DataSource = new object[] { "All State Cases", "Non-UNISYS Only", "UNISYS Only" };
    }

    It displayed no value in the drop down and gave me an undescriptive error "Missing or invalid parameter value. Please input valid data for all parameters".

    Not Sure where I went wrong. "HelloString" is the name of my parameter and I have bound the DisplayMember and ValueMember properties to = Parameters.HelloString.Value

    I am not sure where I am going wrong and would appreciate your suggestions:

    Thanks for your time in advance !
  8. Harika
    Harika avatar
    9 posts
    Member since:
    Apr 2014

    Posted 25 Apr 2014 in reply to Peter Link to this post

    Hello Peter,

    I tried to implement the solution you proposed in mine and it displayed empty values in the drop down .


    public StateReports()
    {
    //
    // Required for telerik Reporting designer support
    //
    InitializeComponent();
    this.ReportParameters["HelloString"].AvailableValues.DataSource = new object[] { "All State Cases", "Non-UNISYS Only", "UNISYS Only" };
    }

    It displayed no value in the drop down and gave me an undescriptive error "Missing or invalid parameter value. Please input valid data for all parameters".

    Not Sure where I went wrong. "HelloString" is the name of my parameter and I have bound the DisplayMember and ValueMember properties to = Parameters.HelloString.Value

    I am not sure where I am going wrong and would appreciate your suggestions:

    Thanks for your time in advance !
  9. Peter
    Admin
    Peter avatar
    1611 posts

    Posted 30 Apr 2014 Link to this post

    Hi Harika,

    Using the code bellow we have successfully added available values for the HelloString parameter. Give it a try and if you experience any further difficulties please open a support thread and send us the problematic report definition.
    this.ReportParameters["HelloString"].AvailableValues.DataSource = new object[] { "All State Cases", "Non-UNISYS Only", "UNISYS Only" };
    this.ReportParameters["HelloString"].AvailableValues.ValueMember = "=Fields.Item";
    this.ReportParameters["HelloString"].Visible = true;
    this.ReportParameters["HelloString"].Type = ReportParameterType.String;

    Regards,
    Peter
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  10. Harika
    Harika avatar
    9 posts
    Member since:
    Apr 2014

    Posted 30 Apr 2014 in reply to Peter Link to this post


    Thanks Peter.I added the following code in my reports constructor and have set the displaymember property to Text and valueMember property to Value and it worked fine for me.

    public Reports()
    {
    this.ReportParameters["SelectOne"].AvailableValues.DataSource = new object[] { new { Text = "All State Cases", Value = "_" }, new { Text = "Non-UNISYS Only", Value = "NU" }, new { Text = "UNISYS Only", Value = "UN" } };
    }


    I am now running into another issue. I opened up a new thread for it. This is what the issue is. I am unable to see events tab in the properties window for the detail section of my report. I am using Telerik Control Q1 2014 and installed them with admin rights. I am using VS 2010 , windows 7 and 32-bit OS. Is there anything wrong with my installation. I appreciate your help in advance.



  11. Nasko
    Admin
    Nasko avatar
    909 posts

    Posted 05 May 2014 Link to this post

    Hello Harika,

    Thank you for reporting this issue. We have requested some additional information on the issue in your other thread. Let us continue the discussion there, as the problem is not related to the topic discussed in this forum thread.

    Regards,
    Nasko
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  12. Arlene
    Arlene avatar
    2 posts
    Member since:
    Dec 2015

    Posted 01 Jul in reply to Nasko Link to this post

    Hello ,

    How do i achive the same with trdx file .
    i am working with telerik standalone designer and i have requirement to add a paramter that is dropdownlist in my report with predefined values.
    i don"t want to use sqldatasource.

     please advice me

    i want to add 4-5 items to dropdown paramter that is fixed not coming from anydatabase

    is there any solution?

     

  13. Stef
    Admin
    Stef avatar
    3036 posts

    Posted 01 Jul Link to this post

    Hello Arlene,

    Below is a quote from my response in your support ticket# 1047577:
    "Please test if using the CsvDataSource component with 'CSV as Text' suites your requirements. Details how to configure the component are available in CsvDataSource Wizard."

    I hope this helps.

    Regards,
    Stef
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
DevCraft banner