Hi,
Is there a way to count the number of selected values in a multi-valued report parameter? I know the result of a multi-valued parameter is an object array (Object[]) but I would like to know the number of items in the array.
Also, is there a way to know if <select all> option is checked or unchecked, in other words if all values are selected or not?
Thank you.
6 Answers, 1 is accepted
To count a number of values in multivalue parameter you can use the following expression in report:
= Parameters.Parameter1.Value.Length
To check if all values are selected compare the above value with parameter's AvailableValues.Count value:
// returns true or false
= Parameters.Parameter1.Value.Length = Parameters.Parameter1.AvailableValues.Count
Hope this helps.
Regards,
Katia
Progress Telerik


Similar to this:
Is there a property I can use to see which value(s) are selected?
If I have selected 1 and 3 in the multi value parameter list...
I would like to say If parameter.value.contains 1 then do this... if contains 2 then do this...

Similar to this:
Is there a property I can use to see which value(s) are selected?
If I have selected 1 and 3 in the multi value parameter list...
I would like to say If parameter.value.contains 1 then do this... if contains 2 then do this...
[/quote]
IIf (Parameters.Parameter1.Value.Lenght = 1, 'do this 1', IIF (Parameters.Parameter1.Value.Lenght = 2, 'do this 2', IIf (Parameters.Parameter1.Value.Lenght = 3, 'do this 3', 'then selection is either bigger than 3 or = 0')))
Hope you find it useful!

To count a number of values in multivalue parameter you can use the following expression in report:
= Parameters.Parameter1.Value.Length
To check if all values are selected compare the above value with parameter's AvailableValues.Count value:
// returns true or false
= Parameters.Parameter1.Value.Length = Parameters.Parameter1.AvailableValues.Count
Hope this helps.
Regards,
Katia
Progress Telerik
[/quote]
When I dont select anything and just choose Null for a multivalue parameter then the Length field doesnt return 0 and I am unable to Compare to Blank or Null. How does one determine if a MultiValue parameter is Null or Empty.
Thanks,
Aaron
Hi Aaron,
Indeed, when the MultiValue parameter is Null, it does not return an empty collection, hence no Length property. You may use Expressions like:
= IsNull(Parameters.Parameter1.Value, 'Null')
and
= Parameters.Parameter1.Value ?? 'Null'
to check for Null value of the Report Parameter. In the examples when the MultiValue parameter is Null the Expression will return the string 'Null', otherwise - the array with parameter values.
If you would like to check the number of values in a MultiValue parameter and return '0' in the parameter is Null you may use:
= (Parameters.Parameter1.Value ?? Array()).Length
Regards,
Todor
Progress Telerik