Report Parameters Using Code

Feb 21, 2008

Hello Everyone,

I would like to create a report parameter that will allow the user to select a week from a list of all weeks so far this year.

For example:

First Parameter is Week: (Week 1, Week 2, ... , Week 7)
Second Parameter is Year: 2008

How can I accomplish this? Can I create a function and use it as a parameter query?

Thank You in advanced

View 5 Replies


ADVERTISEMENT

Calling A Code Block Using Parameters In A Report Of Sql Server Reporting Services

Dec 18, 2007


Hi

This is the code which I have written in code window.

Public Shared Function CalcLocalFactor(ByVal CalcLifeCode As Integer, ByVal CalcFiscalAge As Integer, ByVal CalcLifeYearsUsed As Double, ByVal CalcLocConvention As String, ByVal CalcSRate As Integer) As Double
Dim locCalcFiscalAge As Integer = 0
Dim locFactor As Double= 1.0
Dim locFactor1 As Double = 1.0
Dim REM1 As Integer = 1
Dim DEP As Double = 0
Dim YR As Integer
Dim HALF_YEAR As Double
Dim LINEAR As Double
Dim MACR As Double
If CalcFiscalAge > CalcLifeCode + 1 Then
locCalcFiscalAge = 0
locFactor = 1.0
End If
If (CalcLocConvention <> "HALF-YEAR" And CalcLifeYearsUsed < CalcLifeCode) Then
locFactor = Math.Round((CalcLifeYearsUsed / CalcLifeCode), 4)
End If
If (CalcLocConvention = "HALF-YEAR") Then
for YR = 1 to CalcFiscalAge step 1
If YR = CalcLifeCode + 1 Then
locFactor1 = 1
Exit For
End If
If (YR = 1 Or YR = CalcFiscalAge) Then
HALF_YEAR = 2
Else
HALF_YEAR = 1
End If
LINEAR = Math.Round(REM1 / (CalcLifeCode - YR + 1.5) / HALF_YEAR, 4)
MACR = Math.Round(REM1 / CalcLifeCode * CalcSRate / HALF_YEAR, 4)
If MACR >= LINEAR Then
DEP = MACR
Else
DEP = LINEAR
End If
locFactor1 = locFactor1 + DEP
REM1 = 1 - locFactor1
locFactor = locFactor1
Next
End If
Return locFactor
End Function

I'm calling this code in a Report Parameter like below:

=Code.CalcLocalFactor(Parameters!CalcLifeCode.Value,Parameters!CalcFiscalAge.Value,Parameters!CalcLifeYearsUsed.Value,Parameters!CalcLifeYearsUsed.Value, Parameters!CalcSRate.Value )

It is working fine for the first record where as for other records, the value is not getting changed. i.e. the first records value is coming repeatedly for all other records also.

How can I dynamically change the parameter values of the function?

Parameter is not accepting directly the field names, hence I used other parameter to initialize the field and used that parameter for this.

Ex. Parameter Name ; FieldPurchDate (internal) FieldName : PURCHDATE
Other parameter: FieldInDate (internal) FieldName : InDate

While initializing the new parameter CalcPurchDate,, I used an expression for this: Parameters!CalcFiscalAge.Value

=iif(Parameters!FieldPurchDate.Value is nothing, Parameters!FieldInDate.Value,Parameters!FieldPurchDate.Value)

and using this CalcPurchDate for processing of the parameter:

These are some of the things , I am doing ....

Please let me know how to fix this issue...

Thanks in advance

Regards,

Radhika

View 3 Replies View Related

How To Show Description In Report Instead Of Code (Desc For Code Is In Master Table)

Mar 28, 2007

Dear Friends,



I am having 2 Tables.

Table 1: AddressBook
Fields --> User Name, Address, CountryCode



Table 2: Country
Fields --> Country Code, Country Name


Step 1 : I have created a Cube with these two tables using SSAS.



Step 2 : I have created a report in SSRS showing Address list.

The Column in the report are User Name, Address, Country Name



But I have no idea, how to convert this Country Code to Country name.

I am generating the report using the Layout tab. ( Data | Layout | Preview ) Report1.rdl [Design]



Anyone help me to solve this issue. Because, in our project most of the transaction tables have Code and Code description in master table. I need to convert all code into corresponding description in all my reports.




Thanks in advance.





Regards
Ramakrishnan
Singapore
28 March 2007

View 4 Replies View Related

Run Report By Different Parameters Without Having To Enter Information For All Parameters At Same Time

Oct 29, 2013

I have a SSRS report with four parameters,and I want to be able to enter information for two of the parameters and run the report opposed to all four of them. However, when I select allow blanks and only select the parameters that I want to run the report by, the report come back blank..Essentially, I want to be able to the run report by different parameters without having to enter information for all parameters at the same time.

View 2 Replies View Related

How Do I Jump To Another Report Based On A Value In My Current Report? Report Has No Parameters.

May 3, 2007

How do I jump to another report based on a value in my current report. The report that I am jumping from has no parameters, just values.

View 7 Replies View Related

Does Using Sql Parameters Speed Asp.net Code Up?

Mar 4, 2004

does using sql parameters speed asp.net code up?

View 3 Replies View Related

How To Pass Parameters In Url For A Report Published In Reportserver (report Built On Stocked Procedure) ?

Apr 30, 2007

Hi,



I have created a report with the report server project template.

the report is created from stoked procedure having defaut input parameters.

With visual studio, i publish my report on reportserver. whenever i access to my report on this url :

http://localhost/ReportServer/Pages/ReportViewer.aspx?%2fReport+Project4%2fReport4&rs:Command=Render. the created report is with the default parameters.



I would like to know if i can transmet parameters for the stocked procedure to build the report with the request i want.


I tried to put parameter directly in the url in this way

http://localhost/ReportServer/Pages/ReportViewer.aspx?%2fReport+Project4%2fReport4&rs:Command=Render&@region='toto'

but without success.

my error message is that one

An attempt was made to set a report parameter '@region' that is not defined in this report. (rsUnknownReportParameter)





My stocked procedure is :

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER procedure [dbo].[akli] @region varchar ='m'
as
select * from dbo.Report2 where region=@region

The request used to buid the report ?
DECLARE @region varchar
EXECUTE dbo.akli @region


What is wrong in that ?

Thanks for your help.

Arioule

View 1 Replies View Related

Passing Report Parameters To An SSRS 2005 Report Hosted In Sharepoint 2007

Nov 18, 2007

Here is a situation in my company:

We have an Office SharePoint 2007 site, we developed a couple of web parts and added them to our site. We used SQL Server Reporting services 2005 as our reporting solution. The reports are hosted on the report center and when we need a report, we open it by sending a URL requesting the report, passing the report parameters in the URL query string. So the report is filtered based on the parameters passed from the web parts.

But since best practices say that you should host reports directly under SharePoint, by configuring the reporting services to run in the SharePoint integrated mode. We followed the steps and installed SharePointRS and we finally succeeded to publish the reports to a SharePoint folder, but we had a limitation: we are unable to pass the report parameters internally to the report hosted in SharePoint. If we passed them in the query string as the report center case, SharePoint neglects them totally.
So the question is: how can I pass parameters internally between a SharePoint web part and a SQL server 2005 reporting services report hosted in SharePoint?

View 1 Replies View Related

Reporting Services :: Passing Cascaded Parameters From Main Report To Drill Through Report In SSRS?

Sep 16, 2015

I am trying to develop a report from cube,and it has one drill through report.when i click on sales amount field on main report,then it open the drill through report with details.Here i passed the **(category,subcat,product)parameters(Cascaded)** to drill through report in action part of main report.In my main report i have two columns .

columns are **Level**  and              **Salesamount**.  

Values are like  

**[-]category**              **100**
    **[-]subcat**             **50**
         **product**          **30**

when i click on 100, parameters are passed & it open the detail report correctly, but when i click on 50,the values for subcat parameter is not getting values in detail report and same as the product also.

Here i used the expressions in parameter values

**pCategory**----iif(inscope(category),!fields.category.value,split(join(Parameters!category.value,","),","))

**psubcat**----iif(inscope(subcat),!fields.subcat.value,split(join(Parameters!subcat.value,","),","))

**pproduct**----iif(inscope(product),!fields.product.value,split(join(Parameters!product.value,","),","))

View 3 Replies View Related

Reporting Services :: Way To Subscribe SSRS Report Using Dynamic Parameters For Email And Trigger Report

Feb 8, 2015

Is there a way to subscribe SSRS report using dynamic parameters for email and trigger the report from autosys job so that report should generate the exact time the job is triggered.Let me describe, my SSRS report should be triggered on success of one autosys job. i need to send email parameter and time of report schedule from this autosys job.

View 3 Replies View Related

Passing Parameters For SqlDataSource From Code Behind

May 25, 2007

Hi All, Maybe because it's Friday afternoon and I can't think clearly anymore... A really (I guess) simple problem: DataView with SqlDataSource <asp:DataList ID="DataList1" runat="server" DataSourceID="SqlDataSource1">            <ItemTemplate>                <asp:Label ID="id" runat="Server" Text='<%# Eval("ID")%>' />            </ItemTemplate>        </asp:DataList>        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:MyConnectionString %>"                SelectCommand="GetItem" SelectCommandType="StoredProcedure">         </asp:SqlDataSource> Now, what I have to do is to pass two parameters to the stored procedure: 1) ProviderUserKey2) Int ValueBut the question becomes "how"?Even if I define:  <SelectParameters>                <asp:Parameter Name="I_GUID"  />                <asp:Parameter Name="I_TYPE" Type="Int32" DefaultValue="1" />            </SelectParameters>I need to set the parameters from code behind.... Thanks for any suggestions Adam  

View 8 Replies View Related

SqlDataSource Pass Parameters From Code-behind

Jul 15, 2007

how do i pass the paramenters and storedprocedure to dataview from code-behind?
the below code have sqldatasource control but i want to pass through code-behind everything...
 
  <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1"
EmptyDataText="There are no data records to display." DataKeyNames="NewsId">
<Columns>
<asp:BoundField DataField="NewsId" HeaderText="NewsId" InsertVisible="False" ReadOnly="True"
SortExpression="NewsId" />
<asp:BoundField DataField="PostDate" HeaderText="PostDate" SortExpression="PostDate" />
<asp:BoundField DataField="PostedBy" HeaderText="PostedBy" SortExpression="PostedBy" />
<asp:BoundField DataField="PostedByName" HeaderText="PostedByName" SortExpression="PostedByName" />
<asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" />
<asp:BoundField DataField="Body" HeaderText="Body" SortExpression="Body" />
<asp:BoundField DataField="LastUpdated" HeaderText="LastUpdated" SortExpression="LastUpdated" />
<asp:CheckBoxField DataField="IsVisible" HeaderText="IsVisible" SortExpression="IsVisible" />
</Columns>
</asp:GridView> i have storedprocdure which accepts 4 parameters 3 paramenters which user will supply and 1 parameter will be supplied from code-behindwhat i mean by that is:the 4 parameters storedprocedure accepts is:empid, start_date, end_date (user will supply those 3 parameters)internal_id - which internally pass along with other 3 parmeterssomething like this:internal_id, empid, start_date, end_dateany thoughts?thanks.

View 3 Replies View Related

Accessing Parameters In Custom Code

Feb 21, 2008

Hi,

I am trying to retrieve and manipulate the value of the stored procedure parameters in the following custom code:






Code Snippet
Public Function ShowLoading(ByVal intOption as integer, byVal BasicLoading as string, byVal BasicHealthExtra as string, byVal RiderLoading as string, byVal RiderHealthExtra as string, byVal TotalAmount as string) As string

dim strRider as String
dim strCompanyName as string
strCompanyName = Fields!CompanyName.Value

select case strCompanyName
case "and Plus Rider ":
strRider = "Plus Rider"
case "and Assist Rider ":
strRider = "Assist Rider"
end select
return strRider

End Function






However, i got this error when I try to preview the report: An error occurred during local report processing, The definition of the report :

'/reportC' is invalid. There is an error on line 5 of custom code: [BC30469] Reference to a non-shared member requires an object reference.

Any help is greatly appreciated. Thanks in advance.

View 1 Replies View Related

Auto Generate Code For Sp Parameters?

Apr 18, 2007

Is there an easy way to generate the parameters code for calling stored procedures?



Is there an easy way to generate stored procedure code without having to manually type it in? I've seen 3rd party tools, but I was wondering if there's anything within Sql Server to do it.



I'm using c#, visual studio 2005, sql server 2005.



Thanks,



John

View 3 Replies View Related

DtsConnection -- Consuming DTS DataReader In Code W/ Parameters

Sep 27, 2005

I am trying to pass a parameter into the DtsCommand object, but always get the error "a requested parameter does not exist in the package".  I have a variable defined at the top scope named EmailPromotion so I tried the following

View 9 Replies View Related

How To Pass Parameters From Report Viewer To Report Server

Mar 28, 2008

Hi,

I am having hard time in sending parameters to the report server through reportviewer control from my application. Could anybody help me on this issue?. Is there any way to send the parameters and also what kind of configuration do i need on my report project so that it can accept parameters from my application.


Thanks,

View 9 Replies View Related

Pass The Parameters From Main Report To Drillthrough Report

Nov 28, 2007

Good morning, all

I have a really cool Budget report which has two matrices on it. One is used/visible if the user selects four levels of grouping, and one is used if the user selects only three levels of grouping. The four choices for grouping are four fields, Par, FERC, Point, and Resource.

Since grouping is optional, I need a way to pass the parameter for a field that is not grouped on from the main report to the drillthrough report. For example if the user chooses to group on all fields but Point, I need to pass the report parameter that was used by the main report for Point to the drillthrough report as a report parameter.

So, I tried testing the three grouping levels values and if none were equal to "Point" then pass in the parameter by putting the following expression in the Parameter Value box for the Point parameter on the Navigation tab of the datacell of the main report that is the drillthrough link:


=iif(
Parameters!GroupLevel1.Value <> "Point"
and
Parameters!GroupLevel2.Value<>"Point"
and
Parameters!GroupLevel3.Value<>"Point"
,
Join(Parameters!PNTPoint.Value,",")
,
Fields!Point.UniqueName
)

But this is not working; the drillthrough report shows a blank dropdown for the Point parameter and I have to manually set it. Does anyone see an error in the syntax of the iif statement?

Any references, links, resources or good clean jokes would be greatly appreciated.

Thanks,
Kathryn

View 1 Replies View Related

Parameters Filtering In Report Server Project Report.

Oct 22, 2007

Dear All,

Is it possible to poplulate some control like Dropdownlist (for example, with Product names Or Product Ids) from database table in SSRS project type and then filter report by choosing various choice pre-populated in dropdownlist control.

Project Type is : SQL Server Reportings 2005.

Desired Action: Report will run in browser, User will choose specific product and Run the report(filter) to show that product relate results.

any help,

Thanks,

View 4 Replies View Related

Customise Report Parameters In Report Manager

Feb 7, 2007

Is it possible to add custom controls in for parameters in report manager??

I have a parameter that requires the user to click a button and select a bunch of things in another form. How can i do this in reporting services??

I also would like to change the layout of the parameters toolbar, ie. make text boxes smaller widths, show/hide parameters based on other parameter values.

I know i could write my own web page that does this and hide the parameters toolbar when they run the report, but this would mean that we lose other functionality that report manager has, eg. scheduling.

Does anyone know if customising the report manager will become available in a later version??

View 1 Replies View Related

What Is Wrong With This Code? Selecting Data With Stored Procedure With Multiple Parameters

Sep 22, 2005

oConn = New SqlClient.SqlConnection
oConn.ConnectionString = "user id=MyUserID;data source=MyDataSource;persist security info=False;initial catalog=DBname;password=password;"
oCmd = New SqlClient.SqlCommand
oCmd.Connection = oConn
oCmd.CommandType = CommandType.StoredProcedure
oCmd.CommandText = "TestStdInfo"
'parameters block
oParam1 = New SqlClient.SqlParameter("@intSchoolID", Me.ddlSchl.SelectedItem.ToString())
oParam1.Direction = ParameterDirection.Input
oParam1.SqlDbType = SqlDbType.Int
oCmd.Parameters.Add(oParam1)
oParam2 = New SqlClient.SqlParameter("@dob", Convert.ToDateTime(Me.txbBirth.Text))
oParam2.Direction = ParameterDirection.Input
oParam2.SqlDbType = SqlDbType.DateTime
oCmd.Parameters.Add(oParam2)
oParam3 = New SqlClient.SqlParameter("@id", Me.txbID.Text)
oParam3.Direction = ParameterDirection.Input
oParam3.SqlDbType = SqlDbType.VarChar
oCmd.Parameters.Add(oParam3)
oConn.Open()
daStudent = New SqlClient.SqlDataAdapter("TestStdInfo", oConn)
dsStudent = New DataSet
daStudent.Fill(dsStudent)  'This line is highlighted when error happens
oConn.Close()The error I am getting :Exception Details: System.Data.SqlClient.SqlException: Procedure 'TestStdInfo' expects parameter '@intSchoolID', which was not supplied.I am able to see the value during debugging in the autos or command window. Where does it dissapear when it comes to Fill?Could anybody help me with this, if possible fix my code or show the clean code where the procedure called with multiple parameters and dataset filled.Thank you so much for your help.

View 2 Replies View Related

Report Parameters And Jump To Report

Jan 15, 2007

Greetings,

I have two reports, Report A and Report B.

Report A has two parameters defined as "Prompted", meaning the report input area is available for the user.

Report A parameters ---> StartDate, EndDate

When Report B invokes Report A using the Jump To Report Functionality and passing Report B's StartDate and EndDate parameters, Report A seems to think the parameters are implied and not needed and fails to drop down the parameter input area.

This is not desired because the user should be able to change report A's parameters. 

Anyone know a workaround? 

 

View 1 Replies View Related

Sql Code Of Report

Oct 22, 2007

I want see the sql code of himself the made report in CRM. Is that possible ?

View 4 Replies View Related

HTLM Code In My Report

Mar 30, 2007

I'm having problems with HTML code showing up in my reports. I have a website with a sql database on the back end. When users make comments I get html code in my comments field on the database that then shows up when I run my reports that include the comments. Examples;

<Strong> test comment <Strong>

Comment <br><br> test comment

View 2 Replies View Related

Print Report From C# Code

Feb 8, 2007

hi all.

how can i send a report, (stored on the reporting server) to print?

i know i can render it, but i want to print it , is it possible?

View 1 Replies View Related

Report Parameters

Oct 15, 2007



hi there

I am using Reporting Services 2005.

I have 3 report parameters: startdate, enddate, callstatus

My problem is that once I added callstatus to the parameter list my dates were ignored?

What do I need to do to correct it?


My select code is as below:

SELECT Ticket.TicketNumber, Application.ApplicationName, Status.StatusName, Ticket.LastModifiedBy, CONVERT(datetime, Ticket.CreatedDate),
Company.CompanyName
FROM Ticket INNER JOIN
Application ON Ticket.ApplicationID = Application.ApplicationID INNER JOIN
Status ON Ticket.StatusID = Status.StatusID INNER JOIN
Company ON Application.CompanyID = Company.CompanyID
WHERE (CONVERT(datetime, Ticket.CreatedDate) >= @StartDate) AND (CONVERT(datetime, Ticket.CreatedDate) <= @EndDate) AND
(Status.StatusName IN (@CallStatus)) OR
('SELECT ALL' IN (@CallStatus))

My report Parameters have the values listed in the Non-queried part on report parameters

thanks
Dianne

View 3 Replies View Related

Report Parameters BUG!

Sep 19, 2007


Why is it that EVERY TIME you make any change at all to a data set or parameter, RS automatically changes your parameters from single value to Multi-value????

This is VERY annoying.

View 3 Replies View Related

Report Parameters

Jun 7, 2007

Is there a way to force report designer overlook parameter dependencies, so that a report could be displayed by either of the two parameters although one parameter accepts but not requires the other?



For Example:

In my report I have two parameters, DeptID and ProjectID. The two drop downs display Departments and Projects respectively but only if the department is selected, the Projects list becomes active as its expecting a DepartmentID in the stored proc but accepts a null value as well. So, what I would like to achieve is display ALL projects in the Projects list, even if no department is selected. Any ideas how to do that?



Thanks.

View 2 Replies View Related

MDX Report Parameters

Jan 15, 2008

Hello,

I have an mdx report that uses 7 parameters.
How do I stop the parameters from being dependent on one another and cascading?
When a user changes a parameter value, the flashing and repopulating of the other parameter boxes takes longer than the actual report to run.

I've tried removing the dependencies from the parameter dataset mdx code as well as edititng the parameter datasets and removing the dependencies.

Is cascading parameter relationships a default by design?

Any insight would be appreciated.

Thank you.

View 5 Replies View Related

How To Set The Following Report Parameters?

Aug 8, 2007



Hi,
I have a report and the parameters Passed to the report are Cusip and PeriodId through a stored Procedure.

i want to populate the cusip Parameters using a dataset thats got by a sproc called usp_getCusips.

and the PerioId using a dataset thats been got by another sproc called usp_Getperiods...


So in my report i have added 3 datasets one for the main report, one to get the values of the PeriodId and other to get the value of the cusip.

So in my Report parameters for the Parameter Cusip and i have checked the Available value option and selected its corresponding Dataset and value .

and i have also done the same thing for the PeriodId.. But when i run my sproc i am getting this Error.


[rsInvalidReportParameterDependency] The report parameter €˜Cusip€™ has a DefaultValue or a ValidValue that depends on the report parameter €œCusip€?. Forward dependencies are not valid.


[rsInvalidReportParameterDependency] The report parameter €˜PeriodId€™ has a DefaultValue or a ValidValue that depends on the report parameter €œPeriodId€?. Forward dependencies are not valid.


Any Help will be appreciated.

Regards,
Karen

View 7 Replies View Related

Report Parameters

Feb 21, 2008

I've had a report working that uses a parameter that allows null values. So, of course, I have the "Allow Null Values" flag checked on the parameters dialog for the respective parameter. But recently I changed the "Available values" option for the parameter to "From Query" but then I lose the ability to allow a null value! Why is this happening? Why are they mutually exclusive?

View 1 Replies View Related

One Or More Parameters Required To Run The Report

May 12, 2008

I am doing report development against cube. I have a main report and a sub report in the main report. I am collecting the parameters in the main report and passing into sub report which has the same exact parameters. (I am assigning parameters to the sub report from the Fields collection. If I assign from the Parameter collection, it works fine, but I need to do based on Fields collection because I have my grouping like that)

I am getting the error above, what could I be doing wrong?

View 1 Replies View Related

Report Server Parameters

Nov 16, 2007

Hi all,

I'm writing a web interface and calling reports from report server. I first used the ReportViewer control. But it seemed to be impressively faster to directly call the report URL and link that directly in a frame.

This all works fine. But I want to dynamically add the parameter values that are used by the report in my URL string. To find out those, I have written a stored procedure:

CREATE PROCEDURE dbo.spIIMGetReportParameters
@sReportname varchar(255)
AS
BEGIN
SET NOCOUNT ON;
DECLARE @xmlParameter xml
SELECT @xmlParameter =
(SELECT Parameter
FROM [catalog]
WHERE [Name] = @sReportname)
SELECT parameter.Name.value('.','nvarchar(50)') AS ParameterName
FROM @xmlParameter.nodes('/Parameters/Parameter/Name') as parameter(Name)
END

Then I loop through the result and add parameters to the Url string.
But sometimes I get parameters that are not needed.

Is there another way to find at runtime which parameters a report expects?

Thanks,
Jan

View 1 Replies View Related

SSRS Report Parameters

Aug 8, 2007

Hi,

I have kept two Report Parameters "StartDate" and "EndDate" and i have selected From Query and viewed the preview. I got the reults but when i am selecting the two dates it is not validating the condition.

I need the results between StartDate and EndDate. For this i have to set any where in the parameters or is there any other way

can you please help me in this

Thanks
Dinesh


View 15 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved