Showing posts with label parameters. Show all posts
Showing posts with label parameters. Show all posts

Thursday, March 29, 2012

Boolean Report Parameters

Hi, I have created a report parameter using a Boolean data type.

When I preview my Report I can select either True or False for this parameter. Is there any way of changing the 'True' label to say something else and again the same with the 'False' label?

Click on Report-Parameters

Select your parameter and go down to Available Values

Type in a label and the value

ex.

Open - True

Closed - False

Simone

|||This brings the values up in a list box, I was hoping to keep the selection as tick boxes but amend 'True' to say 'Open' for example.|||

I ran into the same issue today when I tried to change "String" parameter to "Boolean", and hoping to have radiobox instead of listbox dropdown.

No good, it'd be boolean type with dropdown, which is the same as "String" type essentially

It'd be nice to able to change label for "True" and "False"

Boolean parameters

Hello,
I'm creating a boolean parameter in Report Designer and set {Label = "Yes",
Value = True} and {Label = "No", Value = False}. Then on Preview Page I see
to radio buttons, the first one is labeled "true" and the other one is
"false". Is this a bug? Can I set the labels I want to this radio buttons?This is a known limitation and scheduled to be addressed in a future
release.
--
Ravi Mumulla (Microsoft)
SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Lesha Akulinin" <leshaakulinin@.mail.ru> wrote in message
news:%23z6nV3BZEHA.3844@.TK2MSFTNGP10.phx.gbl...
> Hello,
> I'm creating a boolean parameter in Report Designer and set {Label ="Yes",
> Value = True} and {Label = "No", Value = False}. Then on Preview Page I
see
> to radio buttons, the first one is labeled "true" and the other one is
> "false". Is this a bug? Can I set the labels I want to this radio buttons?
>|||Changing this behavior, for Booleans, is on our wish list for inclusion in a
future release.
--
Bruce Johnson [MSFT]
Microsoft SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Lesha Akulinin" <leshaakulinin@.mail.ru> wrote in message
news:%23z6nV3BZEHA.3844@.TK2MSFTNGP10.phx.gbl...
> Hello,
> I'm creating a boolean parameter in Report Designer and set {Label ="Yes",
> Value = True} and {Label = "No", Value = False}. Then on Preview Page I
see
> to radio buttons, the first one is labeled "true" and the other one is
> "false". Is this a bug? Can I set the labels I want to this radio buttons?
>

Thursday, March 8, 2012

Blocking in Analysis Services

We have a report in Reporting Services that connects to a Cube. The report has 4 input parameters that are also derived from the same cube. If the report is running and another user tries to select the drop downs for the report or runs just the query portion in report designer, the query will not return until the report has finished. It looks like the report is creating some type of wait. Has anyone ran across something like this?You are in the wrong forum. Moving to Reporting Services forum first.

Blocking and return parameters

Is it possible the existence of a return parameter on an SP running
insert statements would cause blocking to happen (any removing it
might help eliminate it?)
The SPs in question have three INSERT INTO statements using an
@.@.IDENTITY to help populate the second and third tables based on the
PK of the newly inserted record in the first INSERT INTO Statement.
I have recently stared to receive timeout errors in a multi-user
enviroment and wonder if that's part of the cause. In this
environment, users are requerying a table that is also being written
to. The writes are infrequent but the reads of that table are very
frequent.
On the read side I have added Select from TableX WITH (READPAST)...
On the write side I have elimnated the return parameters. I'm hoping
these two approaches help.
Help is greatly appreciated.
lq"Lauren Quantrell" <laurenquantrell@.hotmail.com> wrote in message
news:47e5bd72.0404110746.4de8d6d7@.posting.google.c om...
> Is it possible the existence of a return parameter on an SP running
> insert statements would cause blocking to happen (any removing it
> might help eliminate it?)
> The SPs in question have three INSERT INTO statements using an
> @.@.IDENTITY to help populate the second and third tables based on the
> PK of the newly inserted record in the first INSERT INTO Statement.
> I have recently stared to receive timeout errors in a multi-user
> enviroment and wonder if that's part of the cause. In this
> environment, users are requerying a table that is also being written
> to. The writes are infrequent but the reads of that table are very
> frequent.
> On the read side I have added Select from TableX WITH (READPAST)...
> On the write side I have elimnated the return parameters. I'm hoping
> these two approaches help.
> Help is greatly appreciated.
> lq

I'm not entirely sure I follow your description - stored procedures can have
return values, and output parameters, but not "return parameters" so I'm not
clear as to which one you mean here.

As a general comment, if your three INSERTs are inside a transaction, and
that transaction runs for too long, or requires a lot of locks, then it's
possible that the readers will be affected. But without some more
information, such as the piece of code containing the INSERTs, and some
background information about the tables, it's hard to say.

By the way, READPAST is potentially dangerous, because it means the client
will not see data which it should normally see, so the results returned may
be incomplete. Locking hints are not often required, so you should try other
solutions first.

Simon|||"Lauren Quantrell" <laurenquantrell@.hotmail.com> wrote in message
news:47e5bd72.0404110746.4de8d6d7@.posting.google.c om...
> Is it possible the existence of a return parameter on an SP running
> insert statements would cause blocking to happen (any removing it
> might help eliminate it?)
> The SPs in question have three INSERT INTO statements using an
> @.@.IDENTITY to help populate the second and third tables based on the
> PK of the newly inserted record in the first INSERT INTO Statement.
> I have recently stared to receive timeout errors in a multi-user
> enviroment and wonder if that's part of the cause. In this
> environment, users are requerying a table that is also being written
> to. The writes are infrequent but the reads of that table are very
> frequent.
> On the read side I have added Select from TableX WITH (READPAST)...
> On the write side I have elimnated the return parameters. I'm hoping
> these two approaches help.
> Help is greatly appreciated.
> lq

I'm not entirely sure I follow your description - stored procedures can have
return values, and output parameters, but not "return parameters" so I'm not
clear as to which one you mean here.

As a general comment, if your three INSERTs are inside a transaction, and
that transaction runs for too long, or requires a lot of locks, then it's
possible that the readers will be affected. But without some more
information, such as the piece of code containing the INSERTs, and some
background information about the tables, it's hard to say.

By the way, READPAST is potentially dangerous, because it means the client
will not see data which it should normally see, so the results returned may
be incomplete. Locking hints are not often required, so you should try other
solutions first.

Simon|||Simon,
Thank you for your response. I meant to write that in VBA I have
appended an Output Parameters to the prm collection.

Here is the entire SP:

*** START SP CODE:

Alter Procedure "mySPName"
@.par1 nvarchar(15) = null,
@.par2 int = null,
@.par3 nvarchar(50) = null,
@.par4 nvarchar(50) = null,
@.par5 nvarchar(125) = null,
@.par6 smallint = null,
@.par7 ntext = null,
@.par8 smalldatetime = null,
@.par9 smalldatetime = null,
@.par10 smalldatetime = null,
@.par11 smalldatetime = null,
@.par12 datetime = null,
@.par13 datetime = null,
@.par14 smallint = null,
@.par15 smalldatetime = null,
@.par16 tinyint = null,
@.par17 tinyint = null,
@.par18 tinyint = null,
@.par19 nvarchar(100) = null,
@.par20 int = null,
@.par21 int = null,
@.par22 int = null,
@.PKID int OUTPUT

AS
set nocount on
set xact_abort on

/* Insert new event into tblAppointments */

INSERT INTO
tblAppointments (fld1, fld2, fld3, fld4, fld5, fld6, fld7, fld8,
fld9, fld10, fld11, fld12, fld13, fld14, fld15, fld16, fld17, fld18,
fld19, fld20, fld21,fld22,fld23, fld24)
VALUES
(@.par1, @.par2, @.par3, @.par4, @.par5, @.par6, @.par7,
@.par8, @.par9, @.par10, @.par12,@.par13, @.par14, @.par15, @.par16, @.par17,
@.par18,
@.par19, @.par20, @.par21,@.par22, @.par22,@.par18, @.par18)

/* Note: Some columns above receive data from the same parameters */

SELECT @.PKID = @.@.IDENTITY

/* Create an entry in tblAppointmentHistory */

Insert Into
tblAppointmentsHistory (fldA, fldB, fldC, fldD, fldE)
Values
(@.PKID, @.par2, @.par3,'New Entry','Appt Type = ' + @.par4 + ' ;
AppTitle= ' + @.par5 + ' ; AppDescription= ' + isnull(Cast(@.par7 AS
nvarchar(4000)),'<none>') + ' ; Location = ' + @.par19 + ' ; Start
Date = ' + CAST(@.par12 AS nvarchar(25)) + ' ; End Date = ' +
IsNull(CAST(@.par13 AS nvarchar(25)),'<none'))

***END SP CODE

"Simon Hayes" <sql@.hayes.ch> wrote in message news:<407af642$1_2@.news.bluewin.ch>...
> "Lauren Quantrell" <laurenquantrell@.hotmail.com> wrote in message
> news:47e5bd72.0404110746.4de8d6d7@.posting.google.c om...
> > Is it possible the existence of a return parameter on an SP running
> > insert statements would cause blocking to happen (any removing it
> > might help eliminate it?)
> > The SPs in question have three INSERT INTO statements using an
> > @.@.IDENTITY to help populate the second and third tables based on the
> > PK of the newly inserted record in the first INSERT INTO Statement.
> > I have recently stared to receive timeout errors in a multi-user
> > enviroment and wonder if that's part of the cause. In this
> > environment, users are requerying a table that is also being written
> > to. The writes are infrequent but the reads of that table are very
> > frequent.
> > On the read side I have added Select from TableX WITH (READPAST)...
> > On the write side I have elimnated the return parameters. I'm hoping
> > these two approaches help.
> > Help is greatly appreciated.
> > lq
> I'm not entirely sure I follow your description - stored procedures can have
> return values, and output parameters, but not "return parameters" so I'm not
> clear as to which one you mean here.
> As a general comment, if your three INSERTs are inside a transaction, and
> that transaction runs for too long, or requires a lot of locks, then it's
> possible that the readers will be affected. But without some more
> information, such as the piece of code containing the INSERTs, and some
> background information about the tables, it's hard to say.
> By the way, READPAST is potentially dangerous, because it means the client
> will not see data which it should normally see, so the results returned may
> be incomplete. Locking hints are not often required, so you should try other
> solutions first.
> Simon|||Simon,
Thank you for your response. I meant to write that in VBA I have
appended an Output Parameters to the prm collection.

Here is the entire SP:

*** START SP CODE:

Alter Procedure "mySPName"
@.par1 nvarchar(15) = null,
@.par2 int = null,
@.par3 nvarchar(50) = null,
@.par4 nvarchar(50) = null,
@.par5 nvarchar(125) = null,
@.par6 smallint = null,
@.par7 ntext = null,
@.par8 smalldatetime = null,
@.par9 smalldatetime = null,
@.par10 smalldatetime = null,
@.par11 smalldatetime = null,
@.par12 datetime = null,
@.par13 datetime = null,
@.par14 smallint = null,
@.par15 smalldatetime = null,
@.par16 tinyint = null,
@.par17 tinyint = null,
@.par18 tinyint = null,
@.par19 nvarchar(100) = null,
@.par20 int = null,
@.par21 int = null,
@.par22 int = null,
@.PKID int OUTPUT

AS
set nocount on
set xact_abort on

/* Insert new event into tblAppointments */

INSERT INTO
tblAppointments (fld1, fld2, fld3, fld4, fld5, fld6, fld7, fld8,
fld9, fld10, fld11, fld12, fld13, fld14, fld15, fld16, fld17, fld18,
fld19, fld20, fld21,fld22,fld23, fld24)
VALUES
(@.par1, @.par2, @.par3, @.par4, @.par5, @.par6, @.par7,
@.par8, @.par9, @.par10, @.par12,@.par13, @.par14, @.par15, @.par16, @.par17,
@.par18,
@.par19, @.par20, @.par21,@.par22, @.par22,@.par18, @.par18)

/* Note: Some columns above receive data from the same parameters */

SELECT @.PKID = @.@.IDENTITY

/* Create an entry in tblAppointmentHistory */

Insert Into
tblAppointmentsHistory (fldA, fldB, fldC, fldD, fldE)
Values
(@.PKID, @.par2, @.par3,'New Entry','Appt Type = ' + @.par4 + ' ;
AppTitle= ' + @.par5 + ' ; AppDescription= ' + isnull(Cast(@.par7 AS
nvarchar(4000)),'<none>') + ' ; Location = ' + @.par19 + ' ; Start
Date = ' + CAST(@.par12 AS nvarchar(25)) + ' ; End Date = ' +
IsNull(CAST(@.par13 AS nvarchar(25)),'<none'))

***END SP CODE

"Simon Hayes" <sql@.hayes.ch> wrote in message news:<407af642$1_2@.news.bluewin.ch>...
> "Lauren Quantrell" <laurenquantrell@.hotmail.com> wrote in message
> news:47e5bd72.0404110746.4de8d6d7@.posting.google.c om...
> > Is it possible the existence of a return parameter on an SP running
> > insert statements would cause blocking to happen (any removing it
> > might help eliminate it?)
> > The SPs in question have three INSERT INTO statements using an
> > @.@.IDENTITY to help populate the second and third tables based on the
> > PK of the newly inserted record in the first INSERT INTO Statement.
> > I have recently stared to receive timeout errors in a multi-user
> > enviroment and wonder if that's part of the cause. In this
> > environment, users are requerying a table that is also being written
> > to. The writes are infrequent but the reads of that table are very
> > frequent.
> > On the read side I have added Select from TableX WITH (READPAST)...
> > On the write side I have elimnated the return parameters. I'm hoping
> > these two approaches help.
> > Help is greatly appreciated.
> > lq
> I'm not entirely sure I follow your description - stored procedures can have
> return values, and output parameters, but not "return parameters" so I'm not
> clear as to which one you mean here.
> As a general comment, if your three INSERTs are inside a transaction, and
> that transaction runs for too long, or requires a lot of locks, then it's
> possible that the readers will be affected. But without some more
> information, such as the piece of code containing the INSERTs, and some
> background information about the tables, it's hard to say.
> By the way, READPAST is potentially dangerous, because it means the client
> will not see data which it should normally see, so the results returned may
> be incomplete. Locking hints are not often required, so you should try other
> solutions first.
> Simon|||"Lauren Quantrell" <laurenquantrell@.hotmail.com> wrote in message
news:47e5bd72.0404121731.52fe5214@.posting.google.c om...
> Simon,
> Thank you for your response. I meant to write that in VBA I have
> appended an Output Parameters to the prm collection.
> Here is the entire SP:

<snip
At first glance, there doesn't seem to be anything obviously incorrect with
your procedure, assuming that you haven't removed anything significant from
it. Small issues are that you should probably use SCOPE_IDENTITY() instead
of @.@.IDENTITY (see Books Online), and you may want to review your use of SET
XACT_ABORT:

http://www.sommarskog.se/error-hand...html#XACT_ABORT

To go back to your original timeout issue, why do you think the timeouts are
connected to this specific procedure? Have you monitored what's happening on
the server when timeouts occur, especially locking? You can use Profiler to
capture what's happening on the server, and this KB article may be useful:

http://support.microsoft.com/defaul...9&Product=sql2k

Erland also has a tool for examining locks:

http://www.sommarskog.se/sqlutil/aba_lockinfo.html

Simon|||"Lauren Quantrell" <laurenquantrell@.hotmail.com> wrote in message
news:47e5bd72.0404121731.52fe5214@.posting.google.c om...
> Simon,
> Thank you for your response. I meant to write that in VBA I have
> appended an Output Parameters to the prm collection.
> Here is the entire SP:

<snip
At first glance, there doesn't seem to be anything obviously incorrect with
your procedure, assuming that you haven't removed anything significant from
it. Small issues are that you should probably use SCOPE_IDENTITY() instead
of @.@.IDENTITY (see Books Online), and you may want to review your use of SET
XACT_ABORT:

http://www.sommarskog.se/error-hand...html#XACT_ABORT

To go back to your original timeout issue, why do you think the timeouts are
connected to this specific procedure? Have you monitored what's happening on
the server when timeouts occur, especially locking? You can use Profiler to
capture what's happening on the server, and this KB article may be useful:

http://support.microsoft.com/defaul...9&Product=sql2k

Erland also has a tool for examining locks:

http://www.sommarskog.se/sqlutil/aba_lockinfo.html

Simon

Friday, February 24, 2012

Blank window Problem

Hi everyone...
I ve a problem that is-
Scenario:
I open report using url access from html page. Parameters are passed in from
html page as hidden fields. Url of report is in Action attribute of form in
the page. So, when i submit it it opens BLANK WINDOW and the opens prompt
window for saving or opening option.
Problem:
I dont want this blank window.
Please help! I am looking replies from MS guys as i couldnt find it anywhere!
--
Suneet Mohan
Microsoft Certified ProfessionalOn Sat, 2 Apr 2005 10:51:02 -0800, Suneet <suneetmohan@.gmail.com>
wrote:
>Hi everyone...
>I ve a problem that is-
>Scenario:
>I open report using url access from html page. Parameters are passed in from
>html page as hidden fields. Url of report is in Action attribute of form in
>the page. So, when i submit it it opens BLANK WINDOW and the opens prompt
>window for saving or opening option.
>Problem:
>I dont want this blank window.
>Please help! I am looking replies from MS guys as i couldnt find it anywhere!
>--
>Suneet Mohan
>Microsoft Certified Professional
It would be helpful to see the URL that is created and which seems to
fail.
Andrew Watt
MVP - InfoPath

Sunday, February 19, 2012

Blank Parameters do not work when running stored proc in Data view

I have a stored procedure that gives different outputs based on whether an
input parameter is given or not. When I set the parameter to blank, not
NULL, I assume this will give the same result as running it in Query Analyzer
and not inputting anything for that parameter, but instead I get a "input
string was not in the correct format" error. Is this a bug? It is not the
behavior I would expect. I think it is very important that blank parameters
work correctly.I'm talking about the parameters in a SQL Server stored procedure. When I
run the report, it's fine if I allow blank values, and there is no error.
Only in Data View do I get the error when I try to run it or do refresh
fields, and it asks me to input all parameters.
"Aaron Williams" wrote:
> Did you set the parameter to allow blank values?
> "Stefan Wrobel" wrote:
> > I have a stored procedure that gives different outputs based on whether an
> > input parameter is given or not. When I set the parameter to blank, not
> > NULL, I assume this will give the same result as running it in Query Analyzer
> > and not inputting anything for that parameter, but instead I get a "input
> > string was not in the correct format" error. Is this a bug? It is not the
> > behavior I would expect. I think it is very important that blank parameters
> > work correctly.|||That seems about correct. I assumed if you specified a parameter as blank it
was like not sending it to the SP at all. For clarification, I only need to
use 2 of the 4 parameters for the report, so I just deleted the 2 I didn't
need from the parameters list. I assume its as if the Report Server doesn't
even know these parameters exist, and doesn't attempt to set them to
anything. This is how I want it. However, in Data View, if I try to get the
fields in the first place, I have to give some sort of value for all 4
parameters, because if I leave the 2 I don't need set to <Blank>, I get that
error. The only time I ever have run into this problem is while designing
the Report, but not anywhere else. It works fine in Query Analyzer, and also
when I run the report through Report Server.
Actually, now that I think about it, to clarify, here's a simple example
that applies to 1 of the 2 parameters.
@.param1 int,
@.param2 int = @.param1
So basically if I don't specify anything for @.param2, it should just be
equal to what I specified for @.param1. However, there doesn't seem to be any
way in Data View not to specify anything. Leaving it set to <blank> I think
it still tries to set the parameter to something, and obviously to something
that causes an error.
I think that's about the best I can do to explain it. It's not like it
prevents me from using Reporting Services, but it is very annoying and seems
counterintuitive.
Thanks for your help.
"Aaron Williams" wrote:
> Could you provide an example of your stored proc?
> Lets make sure we're on the same page. If I get what you're saying, your
> stored proc allows you to send a parameter value if desired, but if you don't
> send anything, then it will still return a query. So your stored proc might
> look something like this:
> CREATE proc MyStoredProcedure
> @.MyParameter int = null
> AS
> SELECT * FROM MyTable
> WHERE (MyPrimaryKey = @.MyParameter OR @.MyParameter is NULL)
> In this case, you can run it in query analyzer like so:
> exec MyStoredProcedure 1 OR exec MyStoredProcedure ('blank')
> In this case, the first would return one record, and the second would return
> ALL records. So, if this is what you mean, then your problem is that when
> you try to pass a ' ' (blank value) to the report parameter you get an error.
> '
> -Aaron
>
> "Stefan Wrobel" wrote:
> > By the way, I'm speaking about when designing a report in Visual Studio
> >
> > "Stefan Wrobel" wrote:
> >
> > > I'm talking about the parameters in a SQL Server stored procedure. When I
> > > run the report, it's fine if I allow blank values, and there is no error.
> > > Only in Data View do I get the error when I try to run it or do refresh
> > > fields, and it asks me to input all parameters.
> > >
> > > "Aaron Williams" wrote:
> > >
> > > > Did you set the parameter to allow blank values?
> > > >
> > > > "Stefan Wrobel" wrote:
> > > >
> > > > > I have a stored procedure that gives different outputs based on whether an
> > > > > input parameter is given or not. When I set the parameter to blank, not
> > > > > NULL, I assume this will give the same result as running it in Query Analyzer
> > > > > and not inputting anything for that parameter, but instead I get a "input
> > > > > string was not in the correct format" error. Is this a bug? It is not the
> > > > > behavior I would expect. I think it is very important that blank parameters
> > > > > work correctly.|||Could you provide an example of your stored proc?
Lets make sure we're on the same page. If I get what you're saying, your
stored proc allows you to send a parameter value if desired, but if you don't
send anything, then it will still return a query. So your stored proc might
look something like this:
CREATE proc MyStoredProcedure
@.MyParameter int = null
AS
SELECT * FROM MyTable
WHERE (MyPrimaryKey = @.MyParameter OR @.MyParameter is NULL)
In this case, you can run it in query analyzer like so:
exec MyStoredProcedure 1 OR exec MyStoredProcedure ('blank')
In this case, the first would return one record, and the second would return
ALL records. So, if this is what you mean, then your problem is that when
you try to pass a ' ' (blank value) to the report parameter you get an error.
'
-Aaron
"Stefan Wrobel" wrote:
> By the way, I'm speaking about when designing a report in Visual Studio
> "Stefan Wrobel" wrote:
> > I'm talking about the parameters in a SQL Server stored procedure. When I
> > run the report, it's fine if I allow blank values, and there is no error.
> > Only in Data View do I get the error when I try to run it or do refresh
> > fields, and it asks me to input all parameters.
> >
> > "Aaron Williams" wrote:
> >
> > > Did you set the parameter to allow blank values?
> > >
> > > "Stefan Wrobel" wrote:
> > >
> > > > I have a stored procedure that gives different outputs based on whether an
> > > > input parameter is given or not. When I set the parameter to blank, not
> > > > NULL, I assume this will give the same result as running it in Query Analyzer
> > > > and not inputting anything for that parameter, but instead I get a "input
> > > > string was not in the correct format" error. Is this a bug? It is not the
> > > > behavior I would expect. I think it is very important that blank parameters
> > > > work correctly.|||I think the way you want it do it will really only work in Query Analyzer.
Reporting Services gets a list of all the parameters in the stored procedure
when you create the dataset. I assume you could do what you said and remove
the unnessisary parameters from the list, but then you no longer have the
option of using them which is obviously something you want to do.
Another option would be to change your stored procedure so that the optional
parameters can accept NULL's and then change the values later. That way
Reporting Services can send a null value to those parameters and you can
still use them the way you desire. Here's an example of how I would change
your stored proc so you can do what you're looking for.
CREATE proc Tmp_TestParams
@.param1 int,
@.param2 int = null,
@.param3 int = null
AS
-- Here's where you set the value of the blank parameters
IF @.param2 IS null
BEGIN
SET @.param2 = @.param1
END
IF @.param3 is null
BEGIN
SET @.param3 = @.param2
END
SELECT @.param1 as Param1, @.param2 as Param2, @.param3 as Param3
Go
exec Tmp_TestParams 1, null, null
Hope this helps!
-Aaron
"Stefan Wrobel" wrote:
> That seems about correct. I assumed if you specified a parameter as blank it
> was like not sending it to the SP at all. For clarification, I only need to
> use 2 of the 4 parameters for the report, so I just deleted the 2 I didn't
> need from the parameters list. I assume its as if the Report Server doesn't
> even know these parameters exist, and doesn't attempt to set them to
> anything. This is how I want it. However, in Data View, if I try to get the
> fields in the first place, I have to give some sort of value for all 4
> parameters, because if I leave the 2 I don't need set to <Blank>, I get that
> error. The only time I ever have run into this problem is while designing
> the Report, but not anywhere else. It works fine in Query Analyzer, and also
> when I run the report through Report Server.
> Actually, now that I think about it, to clarify, here's a simple example
> that applies to 1 of the 2 parameters.
> @.param1 int,
> @.param2 int = @.param1
> So basically if I don't specify anything for @.param2, it should just be
> equal to what I specified for @.param1. However, there doesn't seem to be any
> way in Data View not to specify anything. Leaving it set to <blank> I think
> it still tries to set the parameter to something, and obviously to something
> that causes an error.
> I think that's about the best I can do to explain it. It's not like it
> prevents me from using Reporting Services, but it is very annoying and seems
> counterintuitive.
> Thanks for your help.
> "Aaron Williams" wrote:
> > Could you provide an example of your stored proc?
> >
> > Lets make sure we're on the same page. If I get what you're saying, your
> > stored proc allows you to send a parameter value if desired, but if you don't
> > send anything, then it will still return a query. So your stored proc might
> > look something like this:
> >
> > CREATE proc MyStoredProcedure
> > @.MyParameter int = null
> >
> > AS
> >
> > SELECT * FROM MyTable
> > WHERE (MyPrimaryKey = @.MyParameter OR @.MyParameter is NULL)
> >
> > In this case, you can run it in query analyzer like so:
> >
> > exec MyStoredProcedure 1 OR exec MyStoredProcedure ('blank')
> >
> > In this case, the first would return one record, and the second would return
> > ALL records. So, if this is what you mean, then your problem is that when
> > you try to pass a ' ' (blank value) to the report parameter you get an error.
> > '
> >
> > -Aaron
> >
> >
> > "Stefan Wrobel" wrote:
> >
> > > By the way, I'm speaking about when designing a report in Visual Studio
> > >
> > > "Stefan Wrobel" wrote:
> > >
> > > > I'm talking about the parameters in a SQL Server stored procedure. When I
> > > > run the report, it's fine if I allow blank values, and there is no error.
> > > > Only in Data View do I get the error when I try to run it or do refresh
> > > > fields, and it asks me to input all parameters.
> > > >
> > > > "Aaron Williams" wrote:
> > > >
> > > > > Did you set the parameter to allow blank values?
> > > > >
> > > > > "Stefan Wrobel" wrote:
> > > > >
> > > > > > I have a stored procedure that gives different outputs based on whether an
> > > > > > input parameter is given or not. When I set the parameter to blank, not
> > > > > > NULL, I assume this will give the same result as running it in Query Analyzer
> > > > > > and not inputting anything for that parameter, but instead I get a "input
> > > > > > string was not in the correct format" error. Is this a bug? It is not the
> > > > > > behavior I would expect. I think it is very important that blank parameters
> > > > > > work correctly.|||Good suggestion, thanks!
"Aaron Williams" wrote:
> I think the way you want it do it will really only work in Query Analyzer.
> Reporting Services gets a list of all the parameters in the stored procedure
> when you create the dataset. I assume you could do what you said and remove
> the unnessisary parameters from the list, but then you no longer have the
> option of using them which is obviously something you want to do.
> Another option would be to change your stored procedure so that the optional
> parameters can accept NULL's and then change the values later. That way
> Reporting Services can send a null value to those parameters and you can
> still use them the way you desire. Here's an example of how I would change
> your stored proc so you can do what you're looking for.
> CREATE proc Tmp_TestParams
> @.param1 int,
> @.param2 int = null,
> @.param3 int = null
> AS
> -- Here's where you set the value of the blank parameters
> IF @.param2 IS null
> BEGIN
> SET @.param2 = @.param1
> END
> IF @.param3 is null
> BEGIN
> SET @.param3 = @.param2
> END
> SELECT @.param1 as Param1, @.param2 as Param2, @.param3 as Param3
> Go
> exec Tmp_TestParams 1, null, null
> Hope this helps!
> -Aaron
> "Stefan Wrobel" wrote:
> > That seems about correct. I assumed if you specified a parameter as blank it
> > was like not sending it to the SP at all. For clarification, I only need to
> > use 2 of the 4 parameters for the report, so I just deleted the 2 I didn't
> > need from the parameters list. I assume its as if the Report Server doesn't
> > even know these parameters exist, and doesn't attempt to set them to
> > anything. This is how I want it. However, in Data View, if I try to get the
> > fields in the first place, I have to give some sort of value for all 4
> > parameters, because if I leave the 2 I don't need set to <Blank>, I get that
> > error. The only time I ever have run into this problem is while designing
> > the Report, but not anywhere else. It works fine in Query Analyzer, and also
> > when I run the report through Report Server.
> >
> > Actually, now that I think about it, to clarify, here's a simple example
> > that applies to 1 of the 2 parameters.
> >
> > @.param1 int,
> > @.param2 int = @.param1
> >
> > So basically if I don't specify anything for @.param2, it should just be
> > equal to what I specified for @.param1. However, there doesn't seem to be any
> > way in Data View not to specify anything. Leaving it set to <blank> I think
> > it still tries to set the parameter to something, and obviously to something
> > that causes an error.
> >
> > I think that's about the best I can do to explain it. It's not like it
> > prevents me from using Reporting Services, but it is very annoying and seems
> > counterintuitive.
> >
> > Thanks for your help.
> >
> > "Aaron Williams" wrote:
> >
> > > Could you provide an example of your stored proc?
> > >
> > > Lets make sure we're on the same page. If I get what you're saying, your
> > > stored proc allows you to send a parameter value if desired, but if you don't
> > > send anything, then it will still return a query. So your stored proc might
> > > look something like this:
> > >
> > > CREATE proc MyStoredProcedure
> > > @.MyParameter int = null
> > >
> > > AS
> > >
> > > SELECT * FROM MyTable
> > > WHERE (MyPrimaryKey = @.MyParameter OR @.MyParameter is NULL)
> > >
> > > In this case, you can run it in query analyzer like so:
> > >
> > > exec MyStoredProcedure 1 OR exec MyStoredProcedure ('blank')
> > >
> > > In this case, the first would return one record, and the second would return
> > > ALL records. So, if this is what you mean, then your problem is that when
> > > you try to pass a ' ' (blank value) to the report parameter you get an error.
> > > '
> > >
> > > -Aaron
> > >
> > >
> > > "Stefan Wrobel" wrote:
> > >
> > > > By the way, I'm speaking about when designing a report in Visual Studio
> > > >
> > > > "Stefan Wrobel" wrote:
> > > >
> > > > > I'm talking about the parameters in a SQL Server stored procedure. When I
> > > > > run the report, it's fine if I allow blank values, and there is no error.
> > > > > Only in Data View do I get the error when I try to run it or do refresh
> > > > > fields, and it asks me to input all parameters.
> > > > >
> > > > > "Aaron Williams" wrote:
> > > > >
> > > > > > Did you set the parameter to allow blank values?
> > > > > >
> > > > > > "Stefan Wrobel" wrote:
> > > > > >
> > > > > > > I have a stored procedure that gives different outputs based on whether an
> > > > > > > input parameter is given or not. When I set the parameter to blank, not
> > > > > > > NULL, I assume this will give the same result as running it in Query Analyzer
> > > > > > > and not inputting anything for that parameter, but instead I get a "input
> > > > > > > string was not in the correct format" error. Is this a bug? It is not the
> > > > > > > behavior I would expect. I think it is very important that blank parameters
> > > > > > > work correctly.|||Did you set the parameter to allow blank values?
"Stefan Wrobel" wrote:
> I have a stored procedure that gives different outputs based on whether an
> input parameter is given or not. When I set the parameter to blank, not
> NULL, I assume this will give the same result as running it in Query Analyzer
> and not inputting anything for that parameter, but instead I get a "input
> string was not in the correct format" error. Is this a bug? It is not the
> behavior I would expect. I think it is very important that blank parameters
> work correctly.|||By the way, I'm speaking about when designing a report in Visual Studio
"Stefan Wrobel" wrote:
> I'm talking about the parameters in a SQL Server stored procedure. When I
> run the report, it's fine if I allow blank values, and there is no error.
> Only in Data View do I get the error when I try to run it or do refresh
> fields, and it asks me to input all parameters.
> "Aaron Williams" wrote:
> > Did you set the parameter to allow blank values?
> >
> > "Stefan Wrobel" wrote:
> >
> > > I have a stored procedure that gives different outputs based on whether an
> > > input parameter is given or not. When I set the parameter to blank, not
> > > NULL, I assume this will give the same result as running it in Query Analyzer
> > > and not inputting anything for that parameter, but instead I get a "input
> > > string was not in the correct format" error. Is this a bug? It is not the
> > > behavior I would expect. I think it is very important that blank parameters
> > > work correctly.

Blank parameters

Hi,

In my report, a parameter has list of values in a drop down list (3 static values - Yes, No, Both). If user selects "Both" the results should contain all values with status Yes and No. My stored proc acheives this as -

ColumnName = @.Parameter + '%' in where clause.

I created Non-Queried list of values with Both as "" (empty string). When I run the report, the report is not getting any values. The matrix is empty where as the dataset and stored procedure are picking values for the same. ("" , empty string in the status parameter)

Is there any way the RS considers the empty values ? How do I achieve this ?

Regards,

Chiro

Ok,

Let me make it clear. The stored proc has a default parameter "Status" for which if you neither give "YES" nor give "NO" it gets results for all YES and NO status. This is acheived as

1. I defined stored procedure as - CREATE PROCEDURE ProcName @.Status = '%' varchar(10), @.Param2 varchar(10).......

2. In where clause - ColumnName = @.Status + '%'

Now if you just execute query without any parameters, it gets all values for status YES as well as NO. This is working fine.

I want to display all these results in a report. I created a list of values parameter with values YES, NO, BOTH for status. I allowed Null and Blank for the parameter.

I am binding the data to a matrix. When I run the report without giving any value to status, it is not displaying results in the matrix at all. Ideally it should display all values with status YES and NO.

Can any one tell me if there is any thing which I am missing here.

Blank Parameters

Hi,
i would like to know how i can let a user have the option to enter in 1 or 2 parameters.
EG. select * from customer where ContractSigned = @.Parm1 and ContractReceived = @.Parm2
i would like the user to have the option to enter in either the signed date, received date or even both. I have tryed using the "Allow blank value" option with no luck
Thanks,
Sundeephttp://blogs.msdn.com/chrishays/archive/2004/07/27/199157.aspx
(If you don't have ValidValues queries, you can ignore that part)
--
This post is provided 'AS IS' with no warranties, and confers no rights. All
rights reserved. Some assembly required. Batteries not included. Your
mileage may vary. Objects in mirror may be closer than they appear. No user
serviceable parts inside. Opening cover voids warranty. Keep out of reach of
children under 3.
"Sundeep" <Sundeep@.discussions.microsoft.com> wrote in message
news:6FB12C24-0AE9-4A65-B04F-C10C13FADF90@.microsoft.com...
> Hi,
> i would like to know how i can let a user have the option to enter in 1 or
2 parameters.
> EG. select * from customer where ContractSigned = @.Parm1 and
ContractReceived = @.Parm2
> i would like the user to have the option to enter in either the signed
date, received date or even both. I have tryed using the "Allow blank value"
option with no luck
> Thanks,
> Sundeep|||thanks i will try that
"Chris Hays [MSFT]" wrote:
> http://blogs.msdn.com/chrishays/archive/2004/07/27/199157.aspx
> (If you don't have ValidValues queries, you can ignore that part)
> --
> This post is provided 'AS IS' with no warranties, and confers no rights. All
> rights reserved. Some assembly required. Batteries not included. Your
> mileage may vary. Objects in mirror may be closer than they appear. No user
> serviceable parts inside. Opening cover voids warranty. Keep out of reach of
> children under 3.
> "Sundeep" <Sundeep@.discussions.microsoft.com> wrote in message
> news:6FB12C24-0AE9-4A65-B04F-C10C13FADF90@.microsoft.com...
> > Hi,
> > i would like to know how i can let a user have the option to enter in 1 or
> 2 parameters.
> >
> > EG. select * from customer where ContractSigned = @.Parm1 and
> ContractReceived = @.Parm2
> >
> > i would like the user to have the option to enter in either the signed
> date, received date or even both. I have tryed using the "Allow blank value"
> option with no luck
> >
> > Thanks,
> > Sundeep
>
>

Blank Parameters

I am trying to use a stored procedure that can accept blank parameters to
return a complete set of data. when I use the preview screen in reporting
services, the sproc does not return anything, yet when i run the sproc from
anywhere else, it works. Is there a setting I am missing to be able pass
balnk values to a sproc from the report?
Yes, if i pass values to the report, not blanks, the sproc does run and
returns data.
--
John Cleveland
Network Manager
Urban systems LtdTry using SQL Profiler to find out what is actually sent to the stored
procedure. Blank might not be blank. Do you expect a NULL or a '' as a blank
in the sp? Anyway, SQL Profiler shows what is actually sent, so you can
modify either Parameter or Stored Procedure accordingly.
Kaisa M. Lindahl Lervik
"John Cleveland" <JohnCleveland@.discussions.microsoft.com> wrote in message
news:EA34E0D4-7E12-4730-96F5-B783261CADF4@.microsoft.com...
>I am trying to use a stored procedure that can accept blank parameters to
> return a complete set of data. when I use the preview screen in reporting
> services, the sproc does not return anything, yet when i run the sproc
> from
> anywhere else, it works. Is there a setting I am missing to be able pass
> balnk values to a sproc from the report?
> Yes, if i pass values to the report, not blanks, the sproc does run and
> returns data.
> --
> John Cleveland
> Network Manager
> Urban systems Ltd
>|||When you click on preview, is it giving a small entry screen ? if yes dont
enter anything like double quotes etc.. before that is it giving a screen?
Amarnath
"John Cleveland" wrote:
> I am trying to use a stored procedure that can accept blank parameters to
> return a complete set of data. when I use the preview screen in reporting
> services, the sproc does not return anything, yet when i run the sproc from
> anywhere else, it works. Is there a setting I am missing to be able pass
> balnk values to a sproc from the report?
> Yes, if i pass values to the report, not blanks, the sproc does run and
> returns data.
> --
> John Cleveland
> Network Manager
> Urban systems Ltd
>|||I ran a trace in profiler and here is what I got:
exec spCostReport @.Project=N'', @.Phase=N''
These are the 2 params i am trying to send. I have default values set in
the sproc that should kick in if the params are blank. I exported the trace
to make sure there was nothing between the '', and there wasn't. Any thing
else to check for?
When I run this from the dataset screen in reporting services, it runs fine
leaving the params blank. it only seems to be when the report is run.
--
John Cleveland
Network Manager
Urban systems Ltd
"Kaisa M. Lindahl Lervik" wrote:
> Try using SQL Profiler to find out what is actually sent to the stored
> procedure. Blank might not be blank. Do you expect a NULL or a '' as a blank
> in the sp? Anyway, SQL Profiler shows what is actually sent, so you can
> modify either Parameter or Stored Procedure accordingly.
> Kaisa M. Lindahl Lervik
> "John Cleveland" <JohnCleveland@.discussions.microsoft.com> wrote in message
> news:EA34E0D4-7E12-4730-96F5-B783261CADF4@.microsoft.com...
> >I am trying to use a stored procedure that can accept blank parameters to
> > return a complete set of data. when I use the preview screen in reporting
> > services, the sproc does not return anything, yet when i run the sproc
> > from
> > anywhere else, it works. Is there a setting I am missing to be able pass
> > balnk values to a sproc from the report?
> >
> > Yes, if i pass values to the report, not blanks, the sproc does run and
> > returns data.
> >
> > --
> > John Cleveland
> > Network Manager
> > Urban systems Ltd
> >
>
>

Thursday, February 16, 2012

Blank page after specifying new parameter criteria.

I'm seeing an issue where, after changing the criteria in two date parameters
and clicking the "View Report" button, the screen is blanked out. If I click
the button again, the criteria is used, and the report is displayed.
Anyone else seeing this?
Is there any solution this?I've been having simular problems, although only on the preview pane, on the
report server it works fine
"Aaron" wrote:
> I'm seeing an issue where, after changing the criteria in two date parameters
> and clicking the "View Report" button, the screen is blanked out. If I click
> the button again, the criteria is used, and the report is displayed.
> Anyone else seeing this?
> Is there any solution this?|||I did notice that if I take out the default values I specified in my
parameters, it doesn't do this anymore. Weird...
Must be a bug.
"Antoon" wrote:
> I've been having simular problems, although only on the preview pane, on the
> report server it works fine
> "Aaron" wrote:
> > I'm seeing an issue where, after changing the criteria in two date parameters
> > and clicking the "View Report" button, the screen is blanked out. If I click
> > the button again, the criteria is used, and the report is displayed.
> >
> > Anyone else seeing this?
> >
> > Is there any solution this?

Blank Multi-value Parameters

Hi,

Lets say I have two multi-value parameters on a report. One is required, the other is not. The multi-value parameter that is not required is allowed to be blank. In the WHERE clause of my query I wanted to do this:

Code Snippet

AND
EXISTS
(SELECT * FROM SomeTable AS ST_1
WHERE (MyCode IN (@.My_Codes2)) OR @.My_Codes2 IS NULL)

Of course I can't do that since multi-value parameters are not allowed to be null. I see that they are allowed to be blank, but how do I check for that? I tried

Code Snippet

OR @.My_Codes2=''

That doesn't work. I can set a default value of 'None' and say:

Code Snippet

OR @.My_Codes2='None'

Unfortunately this doesn't work. As long as the default value is 'None' it's fine. When I fill in the parameter I get the following error:

  • An expression of non-boolean type specified in a context where a condition is expected, near ','.

    Please note that I am not using a TSQL stored procedure here. It's just a plain old embedded SQL statement.

    Thanks,

    DD

    Darren:

    This is kind of klunky, but if @.My_Codes2 is a character datatype you might be able to use the COALESCE function to dodge around this. Instead of a where clause like this:

    Code Snippet

    WHERE (MyCode IN (@.My_Codes2)) OR @.My_Codes2 = '')

    You might be able to get by with something like this:

    Code Snippet

    WHERE (MyCode IN (@.My_Codes2)) OR COALESCE(@.My_Codes2, '') = '')

    As an example, I created a report based in an derived table of integers 1-5 with a multi-value parm @.my_codes2:

    Code Snippet

    select myCode
    from ( select 1 as myCode union all select 2 union all
    select 3 union all select 4 union all select 5
    ) as numbers
    where myCode in (@.My_Codes2) or coalesce(@.My_Codes2, '') = ''

    I turned on PROFILER so that I could catch the interpreted code that was sent to SQL Server from Report Services so that I could examine what Report Services is doing under the hood. When I leave pass a blank for @.My_Codes2 the code gets interpreted into the following and returns all of the data in the table:

    Code Snippet

    exec sp_executesql N'select myCode
    from ( select 1 as myCode union all select 2 union all
    select 3 union all select 4 union all select 5
    ) as numbers
    where myCode in (@.My_Codes2) or coalesce(@.My_Codes2, '''') = ''''',
    N'@.My_Codes2 nvarchar(1)',@.My_Codes2=N' '

    /*
    myCode
    --
    1
    2
    3
    4
    5
    */

    When I pass a parameter of '1' for my parameter it gets interpreted similarly and returns only the matching row:


    Code Snippet

    exec sp_executesql N'select myCode
    from ( select 1 as myCode union all select 2 union all
    select 3 union all select 4 union all select 5
    ) as numbers
    where myCode in (@.My_Codes2) or coalesce(@.My_Codes2, '''') = ''''',
    N'@.My_Codes2 nvarchar(1)',@.My_Codes2=N'1'

    /*
    myCode
    --
    1
    */

    When I actually pass in '1' and '3' as multiple parameters, the statement gets interpreted a little differently and returns the correct two matching rows:


    Code Snippet

    select myCode
    from ( select 1 as myCode union all select 2 union all
    select 3 union all select 4 union all select 5
    ) as numbers
    where myCode in (N'1',N'3') or coalesce(N'1',N'3', '') = ''

    /*
    myCode
    --
    1
    3
    */

    I am not using the coalesce with intentions of catching NULLS but rather am using it is a receiver that will handle the different interpretations of the parameters. The main problem with this is that this will return the entire target list if you pass multiple parameters and the first parameter is a blank.

    |||

    Hi Kent,

    A multi-value parameter can't be null so COALESCE doesn't work unfortunately.

    The way I got around it was by using another parameter:

    Code Snippet

    WHERE MyCode IN (@.My_Codes2))

    OR

    @.Use_Other_Codes = 1

    Klunky but it works.

    Thanks,

    Darren

    |||Darren -

    I think I am trying to do the same thing as you <http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1885823&SiteID=1>. Do you think you could take a look and help me out? I'm not sure I'm fully understanding how you got around your problem.

    Thanks,
    Josh

  • Blank Multi-value Parameters

    Hi,

    Lets say I have two multi-value parameters on a report. One is required, the other is not. The multi-value parameter that is not required is allowed to be blank. In the WHERE clause of my query I wanted to do this:

    Code Snippet

    AND
    EXISTS
    (SELECT * FROM SomeTable AS ST_1
    WHERE (MyCode IN (@.My_Codes2)) OR @.My_Codes2 IS NULL)

    Of course I can't do that since multi-value parameters are not allowed to be null. I see that they are allowed to be blank, but how do I check for that? I tried

    Code Snippet

    OR @.My_Codes2=''

    That doesn't work. I can set a default value of 'None' and say:

    Code Snippet

    OR @.My_Codes2='None'

    Unfortunately this doesn't work. As long as the default value is 'None' it's fine. When I fill in the parameter I get the following error:

  • An expression of non-boolean type specified in a context where a condition is expected, near ','.

    Please note that I am not using a TSQL stored procedure here. It's just a plain old embedded SQL statement.

    Thanks,

    DD

    Darren:

    This is kind of klunky, but if @.My_Codes2 is a character datatype you might be able to use the COALESCE function to dodge around this. Instead of a where clause like this:

    Code Snippet

    WHERE (MyCode IN (@.My_Codes2)) OR @.My_Codes2 = '')

    You might be able to get by with something like this:

    Code Snippet

    WHERE (MyCode IN (@.My_Codes2)) OR COALESCE(@.My_Codes2, '') = '')

    As an example, I created a report based in an derived table of integers 1-5 with a multi-value parm @.my_codes2:

    Code Snippet

    select myCode
    from ( select 1 as myCode union all select 2 union all
    select 3 union all select 4 union all select 5
    ) as numbers
    where myCode in (@.My_Codes2) or coalesce(@.My_Codes2, '') = ''

    I turned on PROFILER so that I could catch the interpreted code that was sent to SQL Server from Report Services so that I could examine what Report Services is doing under the hood. When I leave pass a blank for @.My_Codes2 the code gets interpreted into the following and returns all of the data in the table:

    Code Snippet

    exec sp_executesql N'select myCode
    from ( select 1 as myCode union all select 2 union all
    select 3 union all select 4 union all select 5
    ) as numbers
    where myCode in (@.My_Codes2) or coalesce(@.My_Codes2, '''') = ''''',
    N'@.My_Codes2 nvarchar(1)',@.My_Codes2=N' '

    /*
    myCode
    --
    1
    2
    3
    4
    5
    */

    When I pass a parameter of '1' for my parameter it gets interpreted similarly and returns only the matching row:


    Code Snippet

    exec sp_executesql N'select myCode
    from ( select 1 as myCode union all select 2 union all
    select 3 union all select 4 union all select 5
    ) as numbers
    where myCode in (@.My_Codes2) or coalesce(@.My_Codes2, '''') = ''''',
    N'@.My_Codes2 nvarchar(1)',@.My_Codes2=N'1'

    /*
    myCode
    --
    1
    */

    When I actually pass in '1' and '3' as multiple parameters, the statement gets interpreted a little differently and returns the correct two matching rows:


    Code Snippet

    select myCode
    from ( select 1 as myCode union all select 2 union all
    select 3 union all select 4 union all select 5
    ) as numbers
    where myCode in (N'1',N'3') or coalesce(N'1',N'3', '') = ''

    /*
    myCode
    --
    1
    3
    */

    I am not using the coalesce with intentions of catching NULLS but rather am using it is a receiver that will handle the different interpretations of the parameters. The main problem with this is that this will return the entire target list if you pass multiple parameters and the first parameter is a blank.

    |||

    Hi Kent,

    A multi-value parameter can't be null so COALESCE doesn't work unfortunately.

    The way I got around it was by using another parameter:

    Code Snippet

    WHERE MyCode IN (@.My_Codes2))

    OR

    @.Use_Other_Codes = 1

    Klunky but it works.

    Thanks,

    Darren

    |||Darren -

    I think I am trying to do the same thing as you <http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1885823&SiteID=1>. Do you think you could take a look and help me out? I'm not sure I'm fully understanding how you got around your problem.

    Thanks,
    Josh

  • Blank Field List When Using Stored Procedure

    I am trying to use SQL Server 2000 stored procedure that does not take
    any parameters in the Report Designer. When I run dataset in Data tab
    of report designer and try to REFRESH the fields, this doesn't help
    to get a list of fields. I get no error but no data. So the field list
    is still empty. I tried
    manually entering the fields via the Fields tab on the Data Set view
    or by right clicking in the Fields window and this didn't help. When I
    try to run the
    report I get "An Error has occured during processing. Invalid attempt
    to read when no data is present."
    This is my stored procedure:
    ----
    CREATE PROC dbo.sp_branch_counts
    AS
    IF OBJECT_ID('dbo.temp') IS NOT NULL
    drop table [temp]
    CREATE TABLE [temp] (
    [Branch] [nvarchar] (255) NULL,
    [InProgress] int NULL,
    [Taken] int NULL,
    [Dropped] int NULL
    )
    GO
    declare @.loc nvarchar(50)
    DECLARE loc_cursor CURSOR LOCAL
    FOR
    select branch_id from Branch
    FOR READ ONLY
    OPEN loc_cursor
    FETCH NEXT FROM loc_cursor INTO @.loc
    WHILE @.@.FETCH_STATUS = 0
    BEGIN
    insert into [temp] ([Branch],[InProgress],[Taken],[Dropped])
    select distinct @.loc, * from
    (select count(t.tran_status_id) as InProgress
    from MYPELLA_USER_SHORT u INNER JOIN
    [TRANSACTION] t ON u.username = t.USER_NAME
    INNER JOIN OFFERING o ON t.OFFERING_ID = o.OFFERING_ID
    where T.TRAN_CREATE_DATE >='05/01/2004' AND T.TRAN_CREATE_DATE <= dateadd(day,1,'07/01/2004')
    and t.tran_status_id=1
    and u.branch=@.loc) a,
    (select count(t.tran_status_id) as Taken
    from MYPELLA_USER_SHORT u INNER JOIN
    [TRANSACTION] t ON u.username = t.USER_NAME
    INNER JOIN OFFERING o ON t.OFFERING_ID = o.OFFERING_ID
    where T.TRAN_CREATE_DATE >='05/01/2004' AND T.TRAN_CREATE_DATE <= dateadd(day,1,'07/01/2004')
    and t.tran_status_id=2
    and u.branch=@.loc) b,
    (select count(t.tran_status_id) as Dropped
    from MYPELLA_USER_SHORT u INNER JOIN
    [TRANSACTION] t ON u.username = t.USER_NAME
    INNER JOIN OFFERING o ON t.OFFERING_ID = o.OFFERING_ID
    where T.TRAN_CREATE_DATE >='05/01/2004' AND T.TRAN_CREATE_DATE <= dateadd(day,1,'07/01/2004')
    and t.tran_status_id=3
    and u.branch=@.loc) c
    FETCH NEXT FROM loc_cursor INTO @.loc
    END
    CLOSE loc_cursor
    DEALLOCATE loc_cursor
    select * from [temp] order by Branch
    GO
    Please help!!!Have you tried using a table variable in your stored procedure.
    "Natasha" wrote:
    > I am trying to use SQL Server 2000 stored procedure that does not take
    > any parameters in the Report Designer. When I run dataset in Data tab
    > of report designer and try to REFRESH the fields, this doesn't help
    > to get a list of fields. I get no error but no data. So the field list
    > is still empty. I tried
    > manually entering the fields via the Fields tab on the Data Set view
    > or by right clicking in the Fields window and this didn't help. When I
    > try to run the
    > report I get "An Error has occured during processing. Invalid attempt
    > to read when no data is present."
    > This is my stored procedure:
    > ----
    > CREATE PROC dbo.sp_branch_counts
    > AS
    > IF OBJECT_ID('dbo.temp') IS NOT NULL
    > drop table [temp]
    > CREATE TABLE [temp] (
    > [Branch] [nvarchar] (255) NULL,
    > [InProgress] int NULL,
    > [Taken] int NULL,
    > [Dropped] int NULL
    > )
    > GO
    > declare @.loc nvarchar(50)
    > DECLARE loc_cursor CURSOR LOCAL
    > FOR
    > select branch_id from Branch
    > FOR READ ONLY
    > OPEN loc_cursor
    > FETCH NEXT FROM loc_cursor INTO @.loc
    > WHILE @.@.FETCH_STATUS = 0
    > BEGIN
    > insert into [temp] ([Branch],[InProgress],[Taken],[Dropped])
    > select distinct @.loc, * from
    > (select count(t.tran_status_id) as InProgress
    > from MYPELLA_USER_SHORT u INNER JOIN
    > [TRANSACTION] t ON u.username = t.USER_NAME
    > INNER JOIN OFFERING o ON t.OFFERING_ID = o.OFFERING_ID
    > where T.TRAN_CREATE_DATE >='05/01/2004' AND T.TRAN_CREATE_DATE <=> dateadd(day,1,'07/01/2004')
    > and t.tran_status_id=1
    > and u.branch=@.loc) a,
    > (select count(t.tran_status_id) as Taken
    > from MYPELLA_USER_SHORT u INNER JOIN
    > [TRANSACTION] t ON u.username = t.USER_NAME
    > INNER JOIN OFFERING o ON t.OFFERING_ID = o.OFFERING_ID
    > where T.TRAN_CREATE_DATE >='05/01/2004' AND T.TRAN_CREATE_DATE <=> dateadd(day,1,'07/01/2004')
    > and t.tran_status_id=2
    > and u.branch=@.loc) b,
    > (select count(t.tran_status_id) as Dropped
    > from MYPELLA_USER_SHORT u INNER JOIN
    > [TRANSACTION] t ON u.username = t.USER_NAME
    > INNER JOIN OFFERING o ON t.OFFERING_ID = o.OFFERING_ID
    > where T.TRAN_CREATE_DATE >='05/01/2004' AND T.TRAN_CREATE_DATE <=> dateadd(day,1,'07/01/2004')
    > and t.tran_status_id=3
    > and u.branch=@.loc) c
    > FETCH NEXT FROM loc_cursor INTO @.loc
    > END
    > CLOSE loc_cursor
    > DEALLOCATE loc_cursor
    > select * from [temp] order by Branch
    > GO
    > Please help!!!
    >|||I tried it and it worked. Thank you so much :)
    Natasha
    "B. Mark McKinney" <B. Mark McKinney@.discussions.microsoft.com> wrote in message news:<B724506F-89BA-41B9-B786-9E02FFFA17D3@.microsoft.com>...
    > Have you tried using a table variable in your stored procedure.
    > "Natasha" wrote:
    > > I am trying to use SQL Server 2000 stored procedure that does not take
    > > any parameters in the Report Designer. When I run dataset in Data tab
    > > of report designer and try to REFRESH the fields, this doesn't help
    > > to get a list of fields. I get no error but no data. So the field list
    > > is still empty. I tried
    > > manually entering the fields via the Fields tab on the Data Set view
    > > or by right clicking in the Fields window and this didn't help. When I
    > > try to run the
    > > report I get "An Error has occured during processing. Invalid attempt
    > > to read when no data is present."
    > >
    > > This is my stored procedure:
    > > ----
    > > CREATE PROC dbo.sp_branch_counts
    > > AS
    > >
    > > IF OBJECT_ID('dbo.temp') IS NOT NULL
    > > drop table [temp]
    > > CREATE TABLE [temp] (
    > > [Branch] [nvarchar] (255) NULL,
    > > [InProgress] int NULL,
    > > [Taken] int NULL,
    > > [Dropped] int NULL
    > > )
    > > GO
    > > declare @.loc nvarchar(50)
    > >
    > > DECLARE loc_cursor CURSOR LOCAL
    > > FOR
    > > select branch_id from Branch
    > > FOR READ ONLY
    > > OPEN loc_cursor
    > > FETCH NEXT FROM loc_cursor INTO @.loc
    > > WHILE @.@.FETCH_STATUS = 0
    > > BEGIN
    > > insert into [temp] ([Branch],[InProgress],[Taken],[Dropped])
    > >
    > > select distinct @.loc, * from
    > > (select count(t.tran_status_id) as InProgress
    > > from MYPELLA_USER_SHORT u INNER JOIN
    > > [TRANSACTION] t ON u.username = t.USER_NAME
    > > INNER JOIN OFFERING o ON t.OFFERING_ID = o.OFFERING_ID
    > > where T.TRAN_CREATE_DATE >='05/01/2004' AND T.TRAN_CREATE_DATE <=> > dateadd(day,1,'07/01/2004')
    > > and t.tran_status_id=1
    > > and u.branch=@.loc) a,
    > > (select count(t.tran_status_id) as Taken
    > > from MYPELLA_USER_SHORT u INNER JOIN
    > > [TRANSACTION] t ON u.username = t.USER_NAME
    > > INNER JOIN OFFERING o ON t.OFFERING_ID = o.OFFERING_ID
    > > where T.TRAN_CREATE_DATE >='05/01/2004' AND T.TRAN_CREATE_DATE <=> > dateadd(day,1,'07/01/2004')
    > > and t.tran_status_id=2
    > > and u.branch=@.loc) b,
    > > (select count(t.tran_status_id) as Dropped
    > > from MYPELLA_USER_SHORT u INNER JOIN
    > > [TRANSACTION] t ON u.username = t.USER_NAME
    > > INNER JOIN OFFERING o ON t.OFFERING_ID = o.OFFERING_ID
    > > where T.TRAN_CREATE_DATE >='05/01/2004' AND T.TRAN_CREATE_DATE <=> > dateadd(day,1,'07/01/2004')
    > > and t.tran_status_id=3
    > > and u.branch=@.loc) c
    > > FETCH NEXT FROM loc_cursor INTO @.loc
    > > END
    > > CLOSE loc_cursor
    > > DEALLOCATE loc_cursor
    > >
    > > select * from [temp] order by Branch
    > > GO
    > >
    > > Please help!!!
    > >

    Friday, February 10, 2012

    Bitmask Multi-value report parameters

    Hello all,
    Is there any way to return a multi-value parameter as a sum of the
    values instead of a comma seperated string?
    For example, I have a table where one of the values is a bitmasked
    number, representing a combination of 4 possible options.
    I have the Report Parameter setup with Non-queried values. Ex. Opt1 = 1, Opt2 = 2, Opt3 = 4, Opt4 = 8.
    And in my query, the WHERE clause is setup like: WHERE @.param &
    ColumnX != 0
    But of course, if I select multiple values for Opt1 and Opt3, it
    returns 1,4 instead of 5.
    Any suggestions?
    Thanks - JasonYour parameter can be mapped to an expression. Query parameter and Report
    Parameters are two different things. RS automatically creates the report
    parameter for you so it seems like they are the same thing.
    To do this is a two step process:
    1. In layout tab, Report Menu ->Report Parameters. Change the name of the
    parameter so it does not equal the name in your query.
    2. Dataset tab, click on the ..., parameters tab. In the right column click
    on the mapping and change to an expression which brings up the expression
    builder. Have the expression builder change this to the way you want. You
    might need to create some code behind report to do this.
    I suggest whipping together a little VB test app to work out the code to
    convert a comma separated string into a bitmask.
    Bruce Loehle-Conger
    MVP SQL Server Reporting Services
    "Jason" <flajason@.gmail.com> wrote in message
    news:1176830583.305883.64460@.n59g2000hsh.googlegroups.com...
    > Hello all,
    > Is there any way to return a multi-value parameter as a sum of the
    > values instead of a comma seperated string?
    > For example, I have a table where one of the values is a bitmasked
    > number, representing a combination of 4 possible options.
    > I have the Report Parameter setup with Non-queried values. Ex. Opt1 => 1, Opt2 = 2, Opt3 = 4, Opt4 = 8.
    > And in my query, the WHERE clause is setup like: WHERE @.param &
    > ColumnX != 0
    > But of course, if I select multiple values for Opt1 and Opt3, it
    > returns 1,4 instead of 5.
    > Any suggestions?
    > Thanks - Jason
    >