Showing posts with label expression. Show all posts
Showing posts with label expression. Show all posts

Thursday, March 29, 2012

Error exporting to Excel with expression in footer

I can export to all other formats from the report viewer with no issues, but when I try to render to Excel, I get an exception:

[Exception: Object reference not set to an instance of an object.]

[Exception: An error occurred during rendering of the report.]

[Exception: An error occurred during rendering of the report.]
Microsoft.Reporting.WebForms.ServerReport.ServerUrlRequest(Boolean isAbortable, String url, Stream outputStream, String& mimeType, String& fileNameExtension) +553
Microsoft.Reporting.WebForms.ServerReport.InternalRender(Boolean isAbortable, String format, String deviceInfo, NameValueCollection urlAccessParameters, Stream reportStream, String& mimeType, String& fileNameExtension) +941
Microsoft.Reporting.WebForms.ServerReport.Render(String format, String deviceInfo, NameValueCollection urlAccessParameters, String& mimeType, String& fileNameExtension) +97
Microsoft.Reporting.WebForms.ServerReportControlSource.RenderReport(String format, String deviceInfo, NameValueCollection additionalParams, String& mimeType, String& fileExtension) +126
Microsoft.Reporting.WebForms.ExportOperation.PerformOperation(NameValueCollection urlQuery, HttpResponse response) +153
Microsoft.Reporting.WebForms.HttpHandler.ProcessRequest(HttpContext context) +202
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +154
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64

I've pinned it down to a footer cell that uses an expression to determine the TextAlign property. If I do something as simple as ="Right", I get the error. Of course, if I just use Right, there is no problem. So are expressions not supported in footer cell properties or is there possibly some fix for this?

Thanks.

The only solution would be to keep the textbox in the report body than the footer.

Shyam

|||

How can I get text to act like a page footer in the report body?

In case any MS folks are reading and want to reproduce this problem, here's a simple report that exhibits the behavior:

Code Snippet

<?xml version="1.0" encoding="utf-8"?>

<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">

<BottomMargin>1in</BottomMargin>

<RightMargin>1in</RightMargin>

<rd:DrawGrid>true</rd:DrawGrid>

<InteractiveWidth>8.5in</InteractiveWidth>

<rd:SnapToGrid>true</rd:SnapToGrid>

<Body>

<Height>0.79in</Height>

</Body>

<rd:ReportID>503a3ed2-a87d-4315-8de8-77c3ff0e807f</rd:ReportID>

<LeftMargin>1in</LeftMargin>

<Width>5in</Width>

<InteractiveHeight>11in</InteractiveHeight>

<Language>en-US</Language>

<PageFooter>

<ReportItems>

<Textbox Name="textbox3">

<Top>0.125in</Top>

<rd:DefaultName>textbox3</rd:DefaultName>

<Style>

<TextAlign>=IIf(Globals!PageNumber Mod 2 = 0, "Left", "Right")</TextAlign>

<PaddingLeft>2pt</PaddingLeft>

<PaddingBottom>2pt</PaddingBottom>

<PaddingRight>2pt</PaddingRight>

<PaddingTop>2pt</PaddingTop>

</Style>

<CanGrow>true</CanGrow>

<Value>Test</Value>

</Textbox>

</ReportItems>

<Height>0.375in</Height>

<PrintOnLastPage>true</PrintOnLastPage>

<PrintOnFirstPage>true</PrintOnFirstPage>

</PageFooter>

<TopMargin>1in</TopMargin>

</Report>

|||

Try to handle in the value property of the textbox. For example:

IIf(Globals!PageNumber Mod 2 = 0, CStr(Globals!PageNumber) & Space(15), Space(15) & CStr(Globals!PageNumber))

Shyam

Error exporting to Excel with expression in footer

I can export to all other formats from the report viewer with no issues, but when I try to render to Excel, I get an exception:

[Exception: Object reference not set to an instance of an object.]

[Exception: An error occurred during rendering of the report.]

[Exception: An error occurred during rendering of the report.]
Microsoft.Reporting.WebForms.ServerReport.ServerUrlRequest(Boolean isAbortable, String url, Stream outputStream, String& mimeType, String& fileNameExtension) +553
Microsoft.Reporting.WebForms.ServerReport.InternalRender(Boolean isAbortable, String format, String deviceInfo, NameValueCollection urlAccessParameters, Stream reportStream, String& mimeType, String& fileNameExtension) +941
Microsoft.Reporting.WebForms.ServerReport.Render(String format, String deviceInfo, NameValueCollection urlAccessParameters, String& mimeType, String& fileNameExtension) +97
Microsoft.Reporting.WebForms.ServerReportControlSource.RenderReport(String format, String deviceInfo, NameValueCollection additionalParams, String& mimeType, String& fileExtension) +126
Microsoft.Reporting.WebForms.ExportOperation.PerformOperation(NameValueCollection urlQuery, HttpResponse response) +153
Microsoft.Reporting.WebForms.HttpHandler.ProcessRequest(HttpContext context) +202
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +154
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64

I've pinned it down to a footer cell that uses an expression to determine the TextAlign property. If I do something as simple as ="Right", I get the error. Of course, if I just use Right, there is no problem. So are expressions not supported in footer cell properties or is there possibly some fix for this?

Thanks.

The only solution would be to keep the textbox in the report body than the footer.

Shyam

|||

How can I get text to act like a page footer in the report body?

In case any MS folks are reading and want to reproduce this problem, here's a simple report that exhibits the behavior:

Code Snippet

<?xml version="1.0" encoding="utf-8"?>

<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">

<BottomMargin>1in</BottomMargin>

<RightMargin>1in</RightMargin>

<rd:DrawGrid>true</rd:DrawGrid>

<InteractiveWidth>8.5in</InteractiveWidth>

<rd:SnapToGrid>true</rd:SnapToGrid>

<Body>

<Height>0.79in</Height>

</Body>

<rd:ReportID>503a3ed2-a87d-4315-8de8-77c3ff0e807f</rd:ReportID>

<LeftMargin>1in</LeftMargin>

<Width>5in</Width>

<InteractiveHeight>11in</InteractiveHeight>

<Language>en-US</Language>

<PageFooter>

<ReportItems>

<Textbox Name="textbox3">

<Top>0.125in</Top>

<rd:DefaultName>textbox3</rd:DefaultName>

<Style>

<TextAlign>=IIf(Globals!PageNumber Mod 2 = 0, "Left", "Right")</TextAlign>

<PaddingLeft>2pt</PaddingLeft>

<PaddingBottom>2pt</PaddingBottom>

<PaddingRight>2pt</PaddingRight>

<PaddingTop>2pt</PaddingTop>

</Style>

<CanGrow>true</CanGrow>

<Value>Test</Value>

</Textbox>

</ReportItems>

<Height>0.375in</Height>

<PrintOnLastPage>true</PrintOnLastPage>

<PrintOnFirstPage>true</PrintOnFirstPage>

</PageFooter>

<TopMargin>1in</TopMargin>

</Report>

|||

Try to handle in the value property of the textbox. For example:

IIf(Globals!PageNumber Mod 2 = 0, CStr(Globals!PageNumber) & Space(15), Space(15) & CStr(Globals!PageNumber))

Shyam

Tuesday, March 27, 2012

Error evaluating expression

Greetings my SQL friends.

Why do I get an error message saying that the following expression won't evaluate?

"Select * from Price_grp where price_grp_id >= " + (dt_str, 10, 1252) @.[User::MIN_PRICE_GRP_ID] +
" and " + (dt_str, 10, 1252) @.[User::MIN_PRICE_GRP_ID] + " > 0"

Thanks for your help in advance.

Hi friends,

I have solved the problem now. I didn't change the code but I got it to evaluate in the end. I don't know what I did to fix it but perhaps there was some issue with the spaces. I don't know...

|||

Do you still have a note of the error message you had when it would not evaluate?

Donald

|||

Afraid not. Like I said, not quite sure how I sorted it out but I reckon there was some issue with white spaces or something because the same expression worked without any changes!

Thanks.

Sunday, February 19, 2012

Error BC30654

I get the following error ... Any advice?
The value expression for the query parameter â'@.JIDsâ' contains an error:
[BC30654] 'Return' statement in a Function or a Get must return a value.
--
Frederick Volking
System Architect
SC Dept of Juvenile JusticeIt looks like the parameter gets its value from a function...
Please post the function code...
--
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"FlashMerlot" <FlashMerlot@.discussions.microsoft.com> wrote in message
news:5F5D73EC-6F29-4809-A1A2-6506E0B641EA@.microsoft.com...
>I get the following error ... Any advice?
> The value expression for the query parameter '@.JIDs' contains an error:
> [BC30654] 'Return' statement in a Function or a Get must return a value.
> --
> Frederick Volking
> System Architect
> SC Dept of Juvenile Justice

Friday, February 17, 2012

Error attaching database file

When I tried to attach a database it failed with:
Error 3624:
Location: recbase.cpp:1374
Expression: m_nVars > 0
SPID: 55
Process ID: 952
Some ideas to recover the file?Marco,
Could be a corrupt file.
Did you perform a DBCC CHECKDB prior to detaching? Did you detach the
database before or...? What method are you using to attach i.e.,
sp_attach_db or sp_attach_single_file_db? Do you have admin permissions to
do this?
HTH
Jerry
"Marco Frontini" <iunknown@.libero.it> wrote in message
news:es5ZY5QyFHA.2652@.TK2MSFTNGP14.phx.gbl...
> When I tried to attach a database it failed with:
> Error 3624:
> Location: recbase.cpp:1374
> Expression: m_nVars > 0
> SPID: 55
> Process ID: 952
> Some ideas to recover the file?
>