all groups > sql server reporting services > november 2006 >
You're in the

sql server reporting services

group:

Need to populate a Report with Dynamic field list coming from a sp


Need to populate a Report with Dynamic field list coming from a sp rapiddata
11/14/2006 4:26:01 PM
sql server reporting services:
Is there a way to programatically specify dynamic fields list to be mapped to
reports columns at runtime. The stored procedure returns different fields
list in the result set and these fields need to be bound to report column
Re: Need to populate a Report with Dynamic field list coming from a sp Kaisa M. Lindahl Lervik
11/15/2006 12:00:00 AM
Does your stored procedure always return the same number of columns? Even if
it doesn't in the first place, you could make it.

Try something like

Select Column1 as Col1, Column2 as Col2, Column3 as Col3, NULL as Col4 to
make sure you always get the same number of columns, and that they are
always called the same.

If your store procedure runs against different tables, you could do
something like this (pseudocode):

If @ParameterTableName = 'sales'
begin
select SalesDate as Col1, SalesCustomer as Col2, SalesItem as Col3, NULL as
Col4 from Sales
end
or @ParameterTableName = 'customers'
begin
select CustomerName as Col1, CustomerID as Col2, CustomerAddress as Col3,
CustomerZip as Col4 from Customers
end
(make sure you use the correct syntax, I'm sure mine is a bit wrong)

You probably want to make sure the different columns contain data of more or
less the same length, so your dynamic data doesn't look too weird when you
put them in the columns.

Kaisa M. Lindahl Lervik


[quoted text, click to view]

AddThis Social Bookmark Button