Вопрос

The code below gets the values I have entered for my report parameters in a Windows interface I have written for SSRS. However this only works for parameters that do not allow MultiValue. Since Parameter.Value is a string, I don't know how to assign multivalue to it.

    private RE2005.ParameterValue[] GetParamValueSettings()
    {
        var parameters = new RE2005.ParameterValue[_Parameters.Count()];

        for (int i = 0; i < _Parameters.Count(); i++)
        {
            parameters[i] = new RE2005.ParameterValue();
            parameters[i].Name = _Parameters[i].Name;
            **parameters[i].Value = pnlParams.Controls[_Parameters[i].Name].Text;**
        }

        return parameters;
    }

For the line in bold above I did try this as a test: parameters[i].Value = "A,B,C"; (those are valid values)

But the report Throws an error saying that it needs valid values. In the report this is how I display it: = Join(Parameters!myParameter.Value, ", ")

Any advice appreciated, thanks!

Это было полезно?

Решение

with visual studio 2010, you can initialise the Report parameter with a string array.

with 2005 you may have to add the parameter in multiple times with the same name, but a new value.

This is a proc that would get parameters for a report if there was only one multivalued parameter.

  private RE2005.ParameterValue[] SetParameterValue(string name, string[] values)
    {
        var parameters = new RE2005.ParameterValue[values.Count()];

        for (int i = 0; i < values.Count(); i++)
        {
            parameters[i] = new RE2005.ParameterValue();
            parameters[i].Name = name;
            parameters[i].Value = value;
        }
        return parameters;
    }
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top