Sunday, April 16, 2006

Adding Relational Lookups to Reporting Services

Have not tested this in a production scenario yet, however this looks to be one way to use the results of 1 data set as a lookup for another data set.

1. Create a Reporting Services Report with 2 lists - 1 for lookups & 1 for results.
2. In the lookup list, add a textbox with this code. =Code.setValue(Fields!FirstName.Value, Fields!LastName.Value)
3. In the results list, add a textbox with this code = Code.getValue(Fields!FirstName.Value)

4. Add code:
public openWith as new System.Collections.Generic.Dictionary(Of String, String)

Function setValue(value as object, value2 as object) as object
openWith.Add(value, value2)
return 0
end function

Function getValue(value as object) as object
return openWith(value)
end function


The result should be that you can now lookup unique keys in the dictionary. This would be useful for scenarios involving relational data and MDX results. It could also be used for replacing system application values with their 'friendly-name' reporting equivalents.

No comments: