microsoft / ReportingServicesTools

Reporting Services Powershell Tools
MIT License
458 stars 213 forks source link

Subscriptions with multi-select parameters fail creation #386

Open vytux-com opened 2 years ago

vytux-com commented 2 years ago

Do you want to request a feature or report a bug? When creating a subscription to a report which has multi-select parameters we get an error as only the last value is included and that will normally fail validation especially if these are used as a filter for other parameters.

What is the current behavior? Should be able to pass multiple parameter values not just 1

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.

(Get-rssubscription  -Proxy $SSRSProxy -RsItem "/Debtors Reconciliation").Values

The above query will show that the current subscription has multiple values assigned to some parameters e.g.:

Name       Value Label
----       ----- -----
iCMPNDTID  1          
sFCLTY0ID  2          
sFCLTY0ID  10         
sFCLTY0ID  78         
sFCLTY0ID  34         
sFCLTY0ID  37         
sFCLTY0ID  39         
sFCLTY0ID  41         
sFCLTY0ID  87         
sFCLTY0ID  35         
sFCLTY0ID  36         
sFCLTY0ID  38         
sFCLTY0ID  40         
sFCLTY0ID  86         
sFCLTY0ID  9          
sFCLTY0ID  17         
sFCLTY0ID  25         
sFCLTY0ID  33         
sFCLTY0ID  85         
sFCLTY0ID  8          
sFCLTY0ID  16         
sFCLTY0ID  24         
sFCLTY0ID  32         
sFCLTY0ID  84         
sFCLTY0ID  93         
sFCLTY0ID  20         
sFCLTY0ID  28         
sFCLTY0ID  89         
sFCLTY0ID  96         
sFCLTY0ID  3          
sFCLTY0ID  11         
sFCLTY0ID  19         
sFCLTY0ID  27         
sFCLTY0ID  90         
sFCLTY0ID  97         
sFCLTY0ID  44         
sFCLTY0ID  46         
sFCLTY0ID  53         
sFCLTY0ID  54         
sFCLTY0ID  91         
iDSTDTYP   1          
sPRDCT0ID  7          
sPRDCT0ID  1          
sPRDCT0ID  5          
sPRDCT0ID  2          
sPRDCT0ID  4          
sPRDCT0ID  6          
iFCLGRPID  0          
iPRVDR0ID  0          
iCRNTSRD   2          
iDTYP      2          
iNDRWRTRID 0          
iPRVDR0ID2 0          
iLDGRDTID  1          
iGNGPRD    30         
iCNTDT0ID  0          
iSTDT00ID  0          
iDPRTMNID  0   

The parameters that are passed to New-RsSubscription are defined as a hashtable so when you try to add these, you get a duplicate error.

        [Parameter(Mandatory=$False)]
        [AllowNull()]
        [hashtable]
        $Parameters,

I believe this is the cause of many of the issues where the Export/Import of subscriptions is failing due to InvalidParameterException etc.

Exception occurred while creating subscription! ErrorMessage: [Exception calling "CreateSubscription" with "6" argument(s): "System.Web.Services.Protocols.SoapException: Default value or 
value provided for the report parameter 'sFCLTY0ID' is not a valid value. ---> Microsoft.ReportingServices.Diagnostics.Utilities.InvalidReportParameterException: Default value or value 
provided for the report parameter 'sFCLTY0ID' is not a valid value.

What is the expected behavior? Ability to pass an array of parameters, not a hashtable, and thus enable support for multi-select parameters

Which versions of Powershell and which OS are affected by this issue? Did this work in previous versions of our scripts? This was tested with the 0.0.7.1 release but would be affected by all releases since the merge of #186

The script in https://github.com/microsoft/ReportingServicesTools/issues/291#issuecomment-823238006 is also affected by this issue if your reports have multi-select parameters