How to have a Select All Multi-Value Cascading Parameter

Published Jan 15 2019 12:40 PM 868 Views
Microsoft
First published on MSDN on Jan 29, 2010

I’ve seen several cases that involved Multi-Value Cascading Parameters and how the behavior of those work.  Let me start with the default (Out of the box) behavior.  The example report I’ll be using will make use of the AdventureWorksDW sample database.  I will also be using SQL 2008 R2 November Release, but the same will apply to SQL 2008 Reporting Services as well.

In my report, I have three multi-value parameters.  Each one dependent on the parameter before it (cascading parameters).  The parameters are Category, Subcategory and Product, in that order.

As you can see above, I have Bikes selected for the category which will select all by default as that is my first selection.  But what happens if I now add in another category?

Only the first three are selected after adding Components to the category list.  We have seen where people feel this is a bug, but that was actually intended.  We will only maintain what your current selection is.  On the first selection, we didn’t have anything, we actually didn’t have a dataset yet because I didn’t have it loading by default.  But that initial selection will be Select all.  After that, it will be based on what you have selected.  Removing entries will make it seem that we still select all, but that is because the items left were still selected previously, so nothing really changes.  But adding items to the mix will cause them to not be selected by default.  Only the original selection will remain.

So, then the question comes in, what if i want them to all be selected whenever it gets refreshed?  We currently do not provide for that ability out of the box, but I have a way you can add the functionality into your report.

I will add a disclaimer here.  The code that you will see in this blog has not been fully tested and should not be used in production.  Please be sure to review it first and determine how it will affect performance within your report.

Subcategory

Lets start with the Subcategory parameter as there is nothing we need to do with Category.  To start, you will want to add the following into the code section of the report.  This can be found by going to Report on the Menu bar and selected Report Properties.

Function EncodeParamValue(ByVal ParentParam As Object(), ByVal ChildParam As Integer) As String

Dim i As Integer
Dim EncodedChildParam As String = ""

'Concatenate the ParentParam as the prefix
For i = 0 To ParentParam.Length - 1
If i = 0 Then
EncodedChildParam = CStr(ParentParam(i))
Else
EncodedChildParam = EncodedChildParam + "-" + CStr(ParentParam(i))
End If
Next i

'Add the ChildParam at the end
EncodedChildParam = EncodedChildParam + "_" + CStr(ChildParam)

Return EncodedChildParam

End Function

Function DecodeSubcatParamValue(ByVal SubCategoryIDs As Object()) As Object()

Dim i As Integer
Dim SubCategoryID As String

'Remove the prefix on the parameter values to restore the original value
For i = 0 To SubCategoryIDs.Length - 1
SubCategoryID = SubCategoryIDs(i)
SubCategoryIDs(i) = SubCategoryID.Substring(SubCategoryID.IndexOf("_") + 1)
Next i

Return SubCategoryIDs

End Function

These two functions will be what we use to alter the parameter values.  Essentially saying that the value includes everything.  But we strip it out when we actually want to use it.

The next step is to modify the dataset for Subcategory to make use of the EncodeParamValue function.  We will add a Calculated Field.  You can do this by going to the properties of the DataSet, selecting the Fields section and click on Add, select Calculated Field.

We will call this field ModifiedSubcategoryKey.  This name is based on what the value field was we were using for the Parameter itself which was the ProductSubcategoryKey field.  So, we are just modifying that field a bit.  The expression for that field will be the following:

=Code.EncodeParamValue(Parameters!Category.Value,Fields!ProductSubcategoryKey.Value)

We are using the EncodeParamValue to take in the Category (1st Parameter) list and tack it onto the SubCategoryKey. We then need to adjust the Available Values and Default Values to use the ModifiedSubcategoryKey instead of ProductSubcategoryKey.  This is done in the Parameter Properties for Subcategory.  You will want to change the Value Field to be ModifiedSubcategoryKey.

The last thing we will do for Subcategory is to change the refresh value to “Always Refresh”.  This is done in the Parameter Properties for Subcategory under the Advanced section.

That is all you need to get the Subcategory parameter drop down to work correctly.

Product

Now we need to make sure Product works with the SubcategoryKey, as it expects that as a parameter for its dataset.  It expects an Integer and right now we are giving it bit string. Without changing anything, you will see the following error:

We need to make use of our Decode function as the Parameter Value expression for the Product Dataset.  This is done in the Product Dataset properties under the Parameters section.  The expression we will use is the following:

=Code.DecodeSubcatParamValue(Parameters!Subcategory.Value)

This will take in the big string we created, and break it up to just give us the value we really want.  This allows the Product Drop down to show values, but in order for the Select all behavior to work, we need to use the Encode method as well.  So, we will add a Calculated Field to the Product Dataset called ModifiedProductKey.  The expression for this field will be the following:

=Code.EncodeParamValue(Parameters!Subcategory.Value,Fields!ProductKey.Value)

We then want to change the Available Values and Default Values for the Product Parameter.  This is done in the Parameter Properties for Product.  We want to change the Value Field to ModifiedProductKey.  This will get the Product Drop down to have the Select All behavior we are looking for.

This will introduce two levels of encoding on the product value, so I created a second Decode method which will strip it twice for use in the Report Dataset.

Function DecodeProductParamValue(ByVal ProductIds As Object()) As Object()

Dim i As Integer
Dim ProductId As String

'Remove the prefix on the parameter values to restore the original value
For i = 0 To ProductIds.Length - 1
ProductId = ProductIds(i)
'The first one removes the Category encoding
ProductId = ProductId.Substring(ProductId.IndexOf("_") + 1)
'The second one removes the SubCategory encoding
ProductIds(i) = ProductId.Substring(ProductId.IndexOf("_") + 1)
Next i

Return ProductIds

End Function

Report Dataset

The last thing to take into account is the Dataset for the report itself.  You will need to use the Decode methods for the parameters within the Report Dataset like we did on the Product Dataset for the parameter listing. You will need to do this for both the SubCategory Parameter value as well as the Product Parameter Value using DecodeSubcatParamValue and DecodeProductParamValue respectively.

Hopefully this will help you to get the desired behavior you are interested in.

Adam W. Saxton | Microsoft SQL Server Escalation Services

%3CLINGO-SUB%20id%3D%22lingo-sub-315955%22%20slang%3D%22en-US%22%3EHow%20to%20have%20a%20Select%20All%20Multi-Value%20Cascading%20Parameter%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-315955%22%20slang%3D%22en-US%22%3E%0A%20%26lt%3Bmeta%20http-equiv%3D%22Content-Type%22%20content%3D%22text%2Fhtml%3B%20charset%3DUTF-8%22%20%2F%26gt%3B%3CSTRONG%3E%20First%20published%20on%20MSDN%20on%20Jan%2029%2C%202010%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%3CP%3EI%E2%80%99ve%20seen%20several%20cases%20that%20involved%20Multi-Value%20Cascading%20Parameters%20and%20how%20the%20behavior%20of%20those%20work.%26nbsp%3B%20Let%20me%20start%20with%20the%20default%20(Out%20of%20the%20box)%20behavior.%26nbsp%3B%20The%20example%20report%20I%E2%80%99ll%20be%20using%20will%20make%20use%20of%20the%20AdventureWorksDW%20sample%20database.%26nbsp%3B%20I%20will%20also%20be%20using%20SQL%202008%20R2%20November%20Release%2C%20but%20the%20same%20will%20apply%20to%20SQL%202008%20Reporting%20Services%20as%20well.%3C%2FP%3E%0A%20%20%3CP%3EIn%20my%20report%2C%20I%20have%20three%20multi-value%20parameters.%26nbsp%3B%20Each%20one%20dependent%20on%20the%20parameter%20before%20it%20(cascading%20parameters).%26nbsp%3B%20The%20parameters%20are%20Category%2C%20Subcategory%20and%20Product%2C%20in%20that%20order.%3C%2FP%3E%0A%20%20%3CBLOCKQUOTE%3E%0A%20%20%20%3CP%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F66341iB54C3172BA1E1592%22%20%2F%3E%3C%2FP%3E%0A%20%20%3C%2FBLOCKQUOTE%3E%0A%20%20%3CP%3EAs%20you%20can%20see%20above%2C%20I%20have%20Bikes%20selected%20for%20the%20category%20which%20will%20select%20all%20by%20default%20as%20that%20is%20my%20first%20selection.%26nbsp%3B%20But%20what%20happens%20if%20I%20now%20add%20in%20another%20category%3F%3C%2FP%3E%0A%20%20%3CBLOCKQUOTE%3E%0A%20%20%20%3CP%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F66342i019CA91BB8655077%22%20%2F%3E%3C%2FP%3E%0A%20%20%3C%2FBLOCKQUOTE%3E%0A%20%20%3CP%3EOnly%20the%20first%20three%20are%20selected%20after%20adding%20Components%20to%20the%20category%20list.%26nbsp%3B%20We%20have%20seen%20where%20people%20feel%20this%20is%20a%20bug%2C%20but%20that%20was%20actually%20intended.%26nbsp%3B%20We%20will%20only%20maintain%20what%20your%20current%20selection%20is.%26nbsp%3B%20On%20the%20first%20selection%2C%20we%20didn%E2%80%99t%20have%20anything%2C%20we%20actually%20didn%E2%80%99t%20have%20a%20dataset%20yet%20because%20I%20didn%E2%80%99t%20have%20it%20loading%20by%20default.%26nbsp%3B%20But%20that%20initial%20selection%20will%20be%20Select%20all.%26nbsp%3B%20After%20that%2C%20it%20will%20be%20based%20on%20what%20you%20have%20selected.%26nbsp%3B%20Removing%20entries%20will%20make%20it%20seem%20that%20we%20still%20select%20all%2C%20but%20that%20is%20because%20the%20items%20left%20were%20still%20selected%20previously%2C%20so%20nothing%20really%20changes.%26nbsp%3B%20But%20adding%20items%20to%20the%20mix%20will%20cause%20them%20to%20not%20be%20selected%20by%20default.%26nbsp%3B%20Only%20the%20original%20selection%20will%20remain.%3C%2FP%3E%0A%20%20%3CP%3ESo%2C%20then%20the%20question%20comes%20in%2C%20what%20if%20i%20want%20them%20to%20all%20be%20selected%20whenever%20it%20gets%20refreshed%3F%26nbsp%3B%20We%20currently%20do%20not%20provide%20for%20that%20ability%20out%20of%20the%20box%2C%20but%20I%20have%20a%20way%20you%20can%20add%20the%20functionality%20into%20your%20report.%3C%2FP%3E%0A%20%20%3CP%3EI%20will%20add%20a%20disclaimer%20here.%26nbsp%3B%20The%20code%20that%20you%20will%20see%20in%20this%20blog%20has%20not%20been%20fully%20tested%20and%20should%20not%20be%20used%20in%20production.%26nbsp%3B%20Please%20be%20sure%20to%20review%20it%20first%20and%20determine%20how%20it%20will%20affect%20performance%20within%20your%20report.%3C%2FP%3E%0A%20%20%3CH2%20id%3D%22toc-hId-1674291586%22%20id%3D%22toc-hId-1846892823%22%3ESubcategory%3C%2FH2%3E%0A%20%20%3CP%3ELets%20start%20with%20the%20Subcategory%20parameter%20as%20there%20is%20nothing%20we%20need%20to%20do%20with%20Category.%26nbsp%3B%20To%20start%2C%20you%20will%20want%20to%20add%20the%20following%20into%20the%20code%20section%20of%20the%20report.%26nbsp%3B%20This%20can%20be%20found%20by%20going%20to%20Report%20on%20the%20Menu%20bar%20and%20selected%20Report%20Properties.%3C%2FP%3E%0A%20%20%3CBLOCKQUOTE%3E%0A%20%20%20%3CP%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F66343iD2D02B1009ED3757%22%20%2F%3E%3C%2FP%3E%0A%20%20%3C%2FBLOCKQUOTE%3E%0A%20%20%3CBLOCKQUOTE%3E%0A%20%20%20%3CP%3EFunction%20EncodeParamValue(ByVal%20ParentParam%20As%20Object()%2C%20ByVal%20ChildParam%20As%20Integer)%20As%20String%3C%2FP%3E%0A%20%20%20%3CP%3EDim%20i%20As%20Integer%20%3CBR%20%2F%3E%20Dim%20EncodedChildParam%20As%20String%20%3D%20%22%22%3C%2FP%3E%0A%20%20%20%3CP%3E'Concatenate%20the%20ParentParam%20as%20the%20prefix%20%3CBR%20%2F%3E%20For%20i%20%3D%200%20To%20ParentParam.Length%20-%201%20%3CBR%20%2F%3E%20If%20i%20%3D%200%20Then%20%3CBR%20%2F%3E%20EncodedChildParam%20%3D%20CStr(ParentParam(i))%20%3CBR%20%2F%3E%20Else%20%3CBR%20%2F%3E%20EncodedChildParam%20%3D%20EncodedChildParam%20%2B%20%22-%22%20%2B%20CStr(ParentParam(i))%20%3CBR%20%2F%3E%20End%20If%20%3CBR%20%2F%3E%20Next%20i%3C%2FP%3E%0A%20%20%20%3CP%3E'Add%20the%20ChildParam%20at%20the%20end%20%3CBR%20%2F%3E%20EncodedChildParam%20%3D%20EncodedChildParam%20%2B%20%22_%22%20%2B%20CStr(ChildParam)%3C%2FP%3E%0A%20%20%20%3CP%3EReturn%20EncodedChildParam%3C%2FP%3E%0A%20%20%20%3CP%3EEnd%20Function%3C%2FP%3E%0A%20%20%20%3CP%3EFunction%20DecodeSubcatParamValue(ByVal%20SubCategoryIDs%20As%20Object())%20As%20Object()%3C%2FP%3E%0A%20%20%20%3CP%3EDim%20i%20As%20Integer%20%3CBR%20%2F%3E%20Dim%20SubCategoryID%20As%20String%3C%2FP%3E%0A%20%20%20%3CP%3E'Remove%20the%20prefix%20on%20the%20parameter%20values%20to%20restore%20the%20original%20value%20%3CBR%20%2F%3E%20For%20i%20%3D%200%20To%20SubCategoryIDs.Length%20-%201%20%3CBR%20%2F%3E%20SubCategoryID%20%3D%20SubCategoryIDs(i)%20%3CBR%20%2F%3E%20SubCategoryIDs(i)%20%3D%20SubCategoryID.Substring(SubCategoryID.IndexOf(%22_%22)%20%2B%201)%20%3CBR%20%2F%3E%20Next%20i%3C%2FP%3E%0A%20%20%20%3CP%3EReturn%20SubCategoryIDs%3C%2FP%3E%0A%20%20%20%3CP%3EEnd%20Function%3C%2FP%3E%0A%20%20%3C%2FBLOCKQUOTE%3E%0A%20%20%3CBLOCKQUOTE%3E%0A%20%20%20%3CP%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F66344iE43DD99BE2769273%22%20%2F%3E%3C%2FP%3E%0A%20%20%3C%2FBLOCKQUOTE%3E%0A%20%20%3CP%3EThese%20two%20functions%20will%20be%20what%20we%20use%20to%20alter%20the%20parameter%20values.%26nbsp%3B%20Essentially%20saying%20that%20the%20value%20includes%20everything.%26nbsp%3B%20But%20we%20strip%20it%20out%20when%20we%20actually%20want%20to%20use%20it.%3C%2FP%3E%0A%20%20%3CP%3EThe%20next%20step%20is%20to%20modify%20the%20dataset%20for%20Subcategory%20to%20make%20use%20of%20the%20EncodeParamValue%20function.%26nbsp%3B%20We%20will%20add%20a%20Calculated%20Field.%26nbsp%3B%20You%20can%20do%20this%20by%20going%20to%20the%20properties%20of%20the%20DataSet%2C%20selecting%20the%20Fields%20section%20and%20click%20on%20Add%2C%20select%20Calculated%20Field.%3C%2FP%3E%0A%20%20%3CBLOCKQUOTE%3E%0A%20%20%20%3CP%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F66345i38697A84D2D55365%22%20%2F%3E%3C%2FP%3E%0A%20%20%3C%2FBLOCKQUOTE%3E%0A%20%20%3CP%3EWe%20will%20call%20this%20field%20ModifiedSubcategoryKey.%26nbsp%3B%20This%20name%20is%20based%20on%20what%20the%20value%20field%20was%20we%20were%20using%20for%20the%20Parameter%20itself%20which%20was%20the%20ProductSubcategoryKey%20field.%26nbsp%3B%20So%2C%20we%20are%20just%20modifying%20that%20field%20a%20bit.%26nbsp%3B%20The%20expression%20for%20that%20field%20will%20be%20the%20following%3A%3C%2FP%3E%0A%20%20%3CBLOCKQUOTE%3E%0A%20%20%20%3CP%3E%3DCode.EncodeParamValue(Parameters!Category.Value%2CFields!ProductSubcategoryKey.Value)%3C%2FP%3E%0A%20%20%3C%2FBLOCKQUOTE%3E%0A%20%20%3CP%3EWe%20are%20using%20the%20EncodeParamValue%20to%20take%20in%20the%20Category%20(1st%20Parameter)%20list%20and%20tack%20it%20onto%20the%20SubCategoryKey.%20We%20then%20need%20to%20adjust%20the%20Available%20Values%20and%20Default%20Values%20to%20use%20the%20ModifiedSubcategoryKey%20instead%20of%20ProductSubcategoryKey.%26nbsp%3B%20This%20is%20done%20in%20the%20Parameter%20Properties%20for%20Subcategory.%26nbsp%3B%20You%20will%20want%20to%20change%20the%20Value%20Field%20to%20be%20ModifiedSubcategoryKey.%3C%2FP%3E%0A%20%20%3CP%3EThe%20last%20thing%20we%20will%20do%20for%20Subcategory%20is%20to%20change%20the%20refresh%20value%20to%20%E2%80%9CAlways%20Refresh%E2%80%9D.%26nbsp%3B%20This%20is%20done%20in%20the%20Parameter%20Properties%20for%20Subcategory%20under%20the%20Advanced%20section.%3C%2FP%3E%0A%20%20%3CBLOCKQUOTE%3E%0A%20%20%20%3CP%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F66346iA5074C1556EA833B%22%20%2F%3E%3C%2FP%3E%0A%20%20%3C%2FBLOCKQUOTE%3E%0A%20%20%3CP%3EThat%20is%20all%20you%20need%20to%20get%20the%20Subcategory%20parameter%20drop%20down%20to%20work%20correctly.%3C%2FP%3E%0A%20%20%3CBLOCKQUOTE%3E%0A%20%20%20%3CP%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F66347i013FC0B0F882F399%22%20%2F%3E%3C%2FP%3E%0A%20%20%20%3CP%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F66348iA5BC14D8EEC93E1C%22%20%2F%3E%3C%2FP%3E%0A%20%20%3C%2FBLOCKQUOTE%3E%0A%20%20%3CH2%20id%3D%22toc-hId--877865375%22%20id%3D%22toc-hId--705264138%22%3EProduct%3C%2FH2%3E%0A%20%20%3CP%3ENow%20we%20need%20to%20make%20sure%20Product%20works%20with%20the%20SubcategoryKey%2C%20as%20it%20expects%20that%20as%20a%20parameter%20for%20its%20dataset.%26nbsp%3B%20It%20expects%20an%20Integer%20and%20right%20now%20we%20are%20giving%20it%20bit%20string.%20Without%20changing%20anything%2C%20you%20will%20see%20the%20following%20error%3A%3C%2FP%3E%0A%20%20%3CBLOCKQUOTE%3E%0A%20%20%20%3CP%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F66349i3AD2E9BF74B4DF85%22%20%2F%3E%3C%2FP%3E%0A%20%20%3C%2FBLOCKQUOTE%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3EWe%20need%20to%20make%20use%20of%20our%20Decode%20function%20as%20the%20Parameter%20Value%20expression%20for%20the%20Product%20Dataset.%26nbsp%3B%20This%20is%20done%20in%20the%20Product%20Dataset%20properties%20under%20the%20Parameters%20section.%26nbsp%3B%20The%20expression%20we%20will%20use%20is%20the%20following%3A%3C%2FP%3E%0A%20%20%3CBLOCKQUOTE%3E%0A%20%20%20%3CP%3E%3DCode.DecodeSubcatParamValue(Parameters!Subcategory.Value)%3C%2FP%3E%0A%20%20%3C%2FBLOCKQUOTE%3E%0A%20%20%3CP%3EThis%20will%20take%20in%20the%20big%20string%20we%20created%2C%20and%20break%20it%20up%20to%20just%20give%20us%20the%20value%20we%20really%20want.%26nbsp%3B%20This%20allows%20the%20Product%20Drop%20down%20to%20show%20values%2C%20but%20in%20order%20for%20the%20Select%20all%20behavior%20to%20work%2C%20we%20need%20to%20use%20the%20Encode%20method%20as%20well.%26nbsp%3B%20So%2C%20we%20will%20add%20a%20Calculated%20Field%20to%20the%20Product%20Dataset%20called%20ModifiedProductKey.%26nbsp%3B%20The%20expression%20for%20this%20field%20will%20be%20the%20following%3A%3C%2FP%3E%0A%20%20%3CBLOCKQUOTE%3E%0A%20%20%20%3CP%3E%3DCode.EncodeParamValue(Parameters!Subcategory.Value%2CFields!ProductKey.Value)%3C%2FP%3E%0A%20%20%3C%2FBLOCKQUOTE%3E%0A%20%20%3CP%3EWe%20then%20want%20to%20change%20the%20Available%20Values%20and%20Default%20Values%20for%20the%20Product%20Parameter.%26nbsp%3B%20This%20is%20done%20in%20the%20Parameter%20Properties%20for%20Product.%26nbsp%3B%20We%20want%20to%20change%20the%20Value%20Field%20to%20ModifiedProductKey.%26nbsp%3B%20This%20will%20get%20the%20Product%20Drop%20down%20to%20have%20the%20Select%20All%20behavior%20we%20are%20looking%20for.%3C%2FP%3E%0A%20%20%3CP%3EThis%20will%20introduce%20two%20levels%20of%20encoding%20on%20the%20product%20value%2C%20so%20I%20created%20a%20second%20Decode%20method%20which%20will%20strip%20it%20twice%20for%20use%20in%20the%20Report%20Dataset.%3C%2FP%3E%0A%20%20%3CBLOCKQUOTE%3E%0A%20%20%20%3CP%3EFunction%20DecodeProductParamValue(ByVal%20ProductIds%20As%20Object())%20As%20Object()%3C%2FP%3E%0A%20%20%20%3CP%3EDim%20i%20As%20Integer%20%3CBR%20%2F%3E%20Dim%20ProductId%20As%20String%3C%2FP%3E%0A%20%20%20%3CP%3E'Remove%20the%20prefix%20on%20the%20parameter%20values%20to%20restore%20the%20original%20value%20%3CBR%20%2F%3E%20For%20i%20%3D%200%20To%20ProductIds.Length%20-%201%20%3CBR%20%2F%3E%20ProductId%20%3D%20ProductIds(i)%20%3CBR%20%2F%3E%20'The%20first%20one%20removes%20the%20Category%20encoding%20%3CBR%20%2F%3E%20ProductId%20%3D%20ProductId.Substring(ProductId.IndexOf(%22_%22)%20%2B%201)%20%3CBR%20%2F%3E%20'The%20second%20one%20removes%20the%20SubCategory%20encoding%20%3CBR%20%2F%3E%20ProductIds(i)%20%3D%20ProductId.Substring(ProductId.IndexOf(%22_%22)%20%2B%201)%20%3CBR%20%2F%3E%20Next%20i%3C%2FP%3E%0A%20%20%20%3CP%3EReturn%20ProductIds%3C%2FP%3E%0A%20%20%20%3CP%3EEnd%20Function%3C%2FP%3E%0A%20%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3C%2FBLOCKQUOTE%3E%0A%20%20%3CH2%20id%3D%22toc-hId-864944960%22%20id%3D%22toc-hId-1037546197%22%3EReport%20Dataset%3C%2FH2%3E%0A%20%20%3CP%3EThe%20last%20thing%20to%20take%20into%20account%20is%20the%20Dataset%20for%20the%20report%20itself.%26nbsp%3B%20You%20will%20need%20to%20use%20the%20Decode%20methods%20for%20the%20parameters%20within%20the%20Report%20Dataset%20like%20we%20did%20on%20the%20Product%20Dataset%20for%20the%20parameter%20listing.%20You%20will%20need%20to%20do%20this%20for%20both%20the%20SubCategory%20Parameter%20value%20as%20well%20as%20the%20Product%20Parameter%20Value%20using%20DecodeSubcatParamValue%20and%20DecodeProductParamValue%20respectively.%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3EHopefully%20this%20will%20help%20you%20to%20get%20the%20desired%20behavior%20you%20are%20interested%20in.%3C%2FP%3E%0A%20%20%3CP%3EAdam%20W.%20Saxton%20%7C%20Microsoft%20SQL%20Server%20Escalation%20Services%3C%2FP%3E%0A%20%0A%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-315955%22%20slang%3D%22en-US%22%3EFirst%20published%20on%20MSDN%20on%20Jan%2029%2C%202010%20I%E2%80%99ve%20seen%20several%20cases%20that%20involved%20Multi-Value%20Cascading%20Parameters%20and%20how%20the%20behavior%20of%20those%20work.%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-315955%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EReporting%20Services(SSRS)%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Version history
Last update:
‎Jan 15 2019 12:40 PM
Updated by: