Monday, March 26, 2012

Error when RowNumber is 0

Or is it when the dataset is null? Either way, my report is reporting a
Javasript error when my stored procedure returns no records. I isolated the
expression that is causing the problem. It is:
=iif( RowNumber("DataRecords") Mod 2, "WhiteSmoke", "White")
which I had in the table row Background property to alternate my background
color of the rows. It works fine, except when there are no records.
Can someone tell me how to fix it without removing the expression, which is
what I did to get around it for now. I would like to have the alternating row
colors back if I can. Basically I need to be able to determine that
RowNumber is 0 or that DataRecords, which is my dataset, is null.
BTW, the error did not show up while I was testing under Visual Studio 2005
Pro in Debug mode. Everything appeared fine until I deployed to the server.
If anyone knows how I can catch this type of problem BEFORE I deploy I would
like to know also.
TIA
URW
PS: I had accidentally posted this in the SQL Server Replication Group this
morning. I hope I have the right place (Reporting Services) this time. :-)I found the answer in another post, so the problem has been solved. I should
have searched first and I apologze for not doing that. I guess after I
realized I had posted to the wrong group earlier, I was a bit flustered
Thanks
"URW" wrote:
> Or is it when the dataset is null? Either way, my report is reporting a
> Javasript error when my stored procedure returns no records. I isolated the
> expression that is causing the problem. It is:
> =iif( RowNumber("DataRecords") Mod 2, "WhiteSmoke", "White")
> which I had in the table row Background property to alternate my background
> color of the rows. It works fine, except when there are no records.
> Can someone tell me how to fix it without removing the expression, which is
> what I did to get around it for now. I would like to have the alternating row
> colors back if I can. Basically I need to be able to determine that
> RowNumber is 0 or that DataRecords, which is my dataset, is null.
> BTW, the error did not show up while I was testing under Visual Studio 2005
> Pro in Debug mode. Everything appeared fine until I deployed to the server.
> If anyone knows how I can catch this type of problem BEFORE I deploy I would
> like to know also.
> TIA
> URW
> PS: I had accidentally posted this in the SQL Server Replication Group this
> morning. I hope I have the right place (Reporting Services) this time. :-)|||Could you tell us the solution ;-)?
"URW" <URW@.discussions.microsoft.com> escribió en el mensaje
news:B817A72E-446F-43BF-9B7E-C0A4D2553C15@.microsoft.com...
>I found the answer in another post, so the problem has been solved. I
>should
> have searched first and I apologze for not doing that. I guess after I
> realized I had posted to the wrong group earlier, I was a bit flustered
> Thanks
> "URW" wrote:
>> Or is it when the dataset is null? Either way, my report is reporting a
>> Javasript error when my stored procedure returns no records. I isolated
>> the
>> expression that is causing the problem. It is:
>> =iif( RowNumber("DataRecords") Mod 2, "WhiteSmoke", "White")
>> which I had in the table row Background property to alternate my
>> background
>> color of the rows. It works fine, except when there are no records.
>> Can someone tell me how to fix it without removing the expression, which
>> is
>> what I did to get around it for now. I would like to have the alternating
>> row
>> colors back if I can. Basically I need to be able to determine that
>> RowNumber is 0 or that DataRecords, which is my dataset, is null.
>> BTW, the error did not show up while I was testing under Visual Studio
>> 2005
>> Pro in Debug mode. Everything appeared fine until I deployed to the
>> server.
>> If anyone knows how I can catch this type of problem BEFORE I deploy I
>> would
>> like to know also.
>> TIA
>> URW
>> PS: I had accidentally posted this in the SQL Server Replication Group
>> this
>> morning. I hope I have the right place (Reporting Services) this time.
>> :-)|||Sure.
I just change the expression to
=iif( RowNumber(Nothing)Mod 2, "WhiteSmoke", "White")
I think by defaulting the scope of RowNumber, I am actually counting the
number of rows in the table, rather than the number of rows in the Dataset,
like I was before. Since the dataset can be null, I had problems when I tried
to get the row count for a null object. But the table is never null, and thus
the row count is always save to access and thus no crash. I am not sure if my
explanaition is correct, but that is how I could explain to myself why
getting the row number of a null object worked.
If you search for RowNumber in this group you will find several posts that
refer to this problem. They all show the same solution, but no explanaition
why it works. I hope mine helps but if not at least you have the answer for
my problem.
"Mónica" wrote:
> Could you tell us the solution ;-)?
>
> "URW" <URW@.discussions.microsoft.com> escribió en el mensaje
> news:B817A72E-446F-43BF-9B7E-C0A4D2553C15@.microsoft.com...
> >I found the answer in another post, so the problem has been solved. I
> >should
> > have searched first and I apologze for not doing that. I guess after I
> > realized I had posted to the wrong group earlier, I was a bit flustered
> >
> > Thanks
> >
> > "URW" wrote:
> >
> >> Or is it when the dataset is null? Either way, my report is reporting a
> >> Javasript error when my stored procedure returns no records. I isolated
> >> the
> >> expression that is causing the problem. It is:
> >>
> >> =iif( RowNumber("DataRecords") Mod 2, "WhiteSmoke", "White")
> >>
> >> which I had in the table row Background property to alternate my
> >> background
> >> color of the rows. It works fine, except when there are no records.
> >>
> >> Can someone tell me how to fix it without removing the expression, which
> >> is
> >> what I did to get around it for now. I would like to have the alternating
> >> row
> >> colors back if I can. Basically I need to be able to determine that
> >> RowNumber is 0 or that DataRecords, which is my dataset, is null.
> >>
> >> BTW, the error did not show up while I was testing under Visual Studio
> >> 2005
> >> Pro in Debug mode. Everything appeared fine until I deployed to the
> >> server.
> >> If anyone knows how I can catch this type of problem BEFORE I deploy I
> >> would
> >> like to know also.
> >>
> >> TIA
> >>
> >> URW
> >>
> >> PS: I had accidentally posted this in the SQL Server Replication Group
> >> this
> >> morning. I hope I have the right place (Reporting Services) this time.
> >> :-)
>
>sql

No comments:

Post a Comment