locked
Count the number of values (separated by comma) entered in parameter text box in ssrs reports RRS feed

  • Question

  • I am allowing the users to enter the values in the parameter textbox separated by comma.

    For Example: ID: 245,257,234

    But i want to restrict the number of values entered should be less than 25 ID's and should display a warning message. please help me with screenshots as i am new to SSRS

    Also i want to count the number of values which users entered in the textbox in ssrs reports.Thanks in advance

    Monday, August 26, 2019 8:47 AM

All replies

  • Hi Sowmya,

    I think we could achieve this by adding a warning textbox, and set visibility property for the report items in the report.

    1. Add a textbox in the top of the report set its content with expression:

    ="The the number of values entered should be less than 25 ID's" & vbCrLf & " You have currently entered " & Parameters!ReportParameter1.Value.length &" IDs"

    (notice to delete the " (0) " at the end of your multi-valued parameter)

    2. Set the visibility property in textbox properties.  set the expression 

    =iif(Parameters!ReportParameter1.Value.length<25,true,false)

     

    After these two steps, the report will show a warn textbox, when the count is no less than 25.

    Your could show the count in report, by using length method. Like this expression.

    =parameters!reportparameter.value.length

    Regards,

    Lukas


    MSDN Community Support Please remember to click Mark as Answer; the responses that resolved your issue, and to click Unmark as Answer if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.



    Tuesday, August 27, 2019 2:33 AM
  • Thank you Lukas!
    I modified the expression where i have used the Split function because the below expression was giving me the length of the parameter values entered.
    parameters!ID.value.length

    For example: ID: 7898,3435,5663
    Count: 14(it was counting the length of the ID's entered including comma's)

    Below modified expression worked for me

    split(parameters!ID.value,",").Length

    Tuesday, August 27, 2019 9:23 AM
  • Hi, Sowmya

    I assumed at first you were using multi-valued parameter. Seems you actually use single value and comma separated.

    Glad your case was resolved, you could mark the posts as answer to close this thread. Thanks.

    Regards,

    Lukas


    MSDN Community Support Please remember to click Mark as Answer; the responses that resolved your issue, and to click Unmark as Answer if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, August 28, 2019 1:30 AM