Showing posts with label iam. Show all posts
Showing posts with label iam. Show all posts

Thursday, March 22, 2012

Dynamic Parameters

Iam programatically passing parameters to the rdl file, Right now I have four parameters but if I want to have a choice of giveing only 2 or more that 6 parameters then do I need to have a different RDl files one with 2 parameters & another with 6 parameters.
I dont think it is feasible.
Even I should have the flexibility to add or remove the number of parameters dynamically. is ther any wayhow can I sole this situation.

Example: Iam displaying employee table of AdventureWorks database where Iam passing
Parameter 1.DepartmentId
Parameter 2.Title
and for Hiredate
iam passing i.e
Parameter 3. startdate &
Parameter 4.enddate

now that I have to give all the values in parameters to view the report if I want to all the employees in deptid = 5 having Title="Buyer" but not restricting them with date then it is not possible.

I hope the Above situation is clear please feel free if U have any queries.

HELP ME Dude's

Regards

You could assign default values to all 6 parameters at report design time. If a parameter value isn't specified at runtime the default value will be used instead. Just write your SQL query to take the default values into account and not use the param as a filter value - it generally looks like (@.Title = TableName.Title OR @. Title IS NULL) AND ...
The one caveat is that default values can sometimes throw off the optimizer and make for long running queries.

Sunday, February 19, 2012

Dynamic columns

Hi,

In my report i want to display dynamic columns.For displaying what are columns available to user,Iam displaying the columns names in one multivalued parameter.For example in my report i have Date,CaseId,Age,State as columns,and multivalued parameter name is "Columns".

I wrote a custom function i.e ShowParameterValues(...) returns String s.If we select the Date and CaseID from the columns then s contain value:Date CaseID

Public Function ShowParameterValues(ByVal parameter as Parameter) as string
Dim s as String
For i as integer = 0 to parameter.Count-1
s =s+ CStr(parameter.Value(i))
Next
Return s
End Function

Now i want to show those two columns only.How to acheve this.

Thanks in advance

Currently, the RS object model doesn't support this feature. You can:

1. Include all columns on the report and hiding the ones that are not needed conditionally (Hidden property = True)

2. Implement a custom application which changes and uploads the report definition.

|||

Hi,

How to hide some columns conditionally.I need all the columns,show the columns which the user selects from multivalued parameter.

Thanks in advance

|||

Each column has a Hidden property which can be expression-based, e.g.:

=IIF(<evaluate your parameter selection condition>, True, False)

|||

Hi,

I know this.But how to write the condition,how would we know which column is selected from multivalued parameter

Please help me

Thanks in advance

|||Hi,
i am doing something similar for a selector where the user pick a start period and an end period. I am not using Matrix in this case because I want the table.
Should be similar enough to what you want to do.

In the second Column Hidden property put something like that:

= iif( CountRows("(Items_Selected") <2, True, False)
And increase the number by 1 for each consecutive column.

Have a dataset "Items_Selected" build upon your multi-select, something like that:

select Distinct
Case @.Time_Items when 'Qtr' then b.Qtr when 'Mth' then b.Mth when 'Week' then b.Week end as item
FROM onGlobals.dbo.tb_TimeBillBack b with(nolock)
where Case @.Time_Items when 'Qtr' then b.Qtr when 'Mth' then b.Mth when 'Week' then b.Week end >= @.Period_Start
AND Case @.Time_Items when 'Qtr' then b.Qtr when 'Mth' then b.Mth when 'Week' then b.Week end <= @.Period_End

Where you would have the b table build with all possible values present in your multi-value parameter.

Change the code above to use a IN clause to evaluate your multi-values.

It is kind of a hack which I hate but it works. Set the report layout with all possible columns and set the hidden property of each and every one of them.
Philippe|||http://msdn2.microsoft.com/en-us/library/aa337293.aspx