Showing posts with label multiple. Show all posts
Showing posts with label multiple. Show all posts

Wednesday, March 28, 2012

Problems with Subreports when no data is returned & page breaks ar

I've been fighting a problem in SQL Reporting Services 2005 and am about to
go nuts! I have a main report that contains multiple subreports. Each
subreport is contained within its own List (I've tried Tables too), tied to
the DataSet specific to each subreport. Each subreport may or may not return
data, based on the DataSet of the List/Table.
My problem occurs when one or all of the subreports do not return data. The
users would like each subreport to start on a new page, which I thought
should be simply handled by setting the Page Break at Start property of the
List/Table's Grouping. This does in fact work as desired, but only when ALL
subreports return data. When one (or more) of the subreports is blank, an
extra page is rendered, which when paged to causes an error (An error
occurred during local report processing. An internal error occurred on the
report server. See the error log for more details.) I've been able to find
nothing in any error log, which is what the BOL says for this error (in
addition to telling you that this error should never occcur!).
Can someone please help!? I have a deadline to meet!
Thanks in advance.Hi Jeff,
I am stuck with the same problem and have been recommended to use the NoRows
property. However this does unfortunately not help. The problem seems to
arise as soon as something re-renders the page. In my case a drill-down
re-renders the page and causes this error if I have an empty sub-report on
the page.
If you have found a work-around I would be glad if you could post it.
"Jeff Rautzahn" wrote:
> I've been fighting a problem in SQL Reporting Services 2005 and am about to
> go nuts! I have a main report that contains multiple subreports. Each
> subreport is contained within its own List (I've tried Tables too), tied to
> the DataSet specific to each subreport. Each subreport may or may not return
> data, based on the DataSet of the List/Table.
> My problem occurs when one or all of the subreports do not return data. The
> users would like each subreport to start on a new page, which I thought
> should be simply handled by setting the Page Break at Start property of the
> List/Table's Grouping. This does in fact work as desired, but only when ALL
> subreports return data. When one (or more) of the subreports is blank, an
> extra page is rendered, which when paged to causes an error (An error
> occurred during local report processing. An internal error occurred on the
> report server. See the error log for more details.) I've been able to find
> nothing in any error log, which is what the BOL says for this error (in
> addition to telling you that this error should never occcur!).
> Can someone please help!? I have a deadline to meet!
> Thanks in advance.

Wednesday, March 21, 2012

Problems with PIVOT tables

I'm a having a problem with PIVOT tables.

I have a table that stores the results from multiple surveys, (see format below)...

 
SurveyID RespondantID QuestionID Answer========================================================= 1 1 1 X 1 1 2 Y 1 1 3 Z 1 2 1 R 1 2 2 S 1 2 3 T 14 10 1 A 14 10 2 B 14 11 1 C 14 11 2 D

I want to use a pivot table to convert the data it to a format like the following (for surveyID = 1)...

 
RespondantID Q1 Q2 Q3 =============================== 1 A B C 1 R S T

The 2 differences I need from a normal pivot query are...

(a) I don't want to summarise my results at all(b) I have multiple surveys in the same table so need to use an extra clause to pick out info for the survey I am interested in.

So far I have come up with...

SELECT RespondantID, [1] As Q1, [2] As Q2, [3] As Q3, [4] As Q4, [5] As Q5, [6] As Q6, [7] As Q7, [8] As Q8, [9] As Q9, [10]
As Q10 FROM (SELECT RespondantlD, QuestionlD, Answer FROM "3_Temp" WHERE SurveylD=3) AS preData PIVOT (
COUNT(Answer) FOR QuestionlD IN ([1], [2], [3], [4], [5], [6], [7], [8], [9], [10]) ) AS data ORDER BV RespondantlD

But it doesn't work and I can't figure out why (error message when executing in VBA = "RunSQL function requires a SQL argument"

Can anyone help?

Thanks for posting sample data.

The PIVOT function is for SQL Server 2005, but you mention that you are excuting in VBA?

By the way, is this correct?

RespondantID Q1 Q2 Q3
===============================
1 A B C
1 2 R S T

If you need help for your question in either SQL Server 2005 or 2000, please post back.

|||

Yes that should be respondantID 2.

I am building an access data project (.adp) which links to tables in SQL Server 2005 so it is a SQL issue.

Thanks,

Martin

|||

Answer to your Question q: The aggregate function is required here, but you can use MAX instead of COUNT.

Answer to your Question b: No problem. As as you did in your query.

I don't know whether you can run this with your setup. Let us know if you find out.

I can run this in SQL Server 2005 Management Studio:

SELECT RespondantID, [1]As Q1, [2]As Q2, [3]As Q3, [4]As Q4, [5]As Q5, [6]As Q6, [7]As Q7, [8]As Q8, [9]As Q9, [10]

As Q10FROM(SELECT RespondantID, QuestionID, AnswerFROM [3_Temp]

WHERE SurveyID=1)AS preDataPIVOT

(MAX(Answer)FOR QuestionIDIN([1], [2], [3], [4], [5], [6], [7], [8], [9], [10]))

AS data

ORDERBY RespondantID

|||

Thanks for correcting my code Limno!

The only problem now is that I need to export the data to excel, but access will only do this from a table. I tried saving the above code as a view and then doing

SELECT *INTO tablenameFROM PivotedView
but I get an error saying "could not find PivotedView". Do you know how I can modify the pivot query directly, i.e.
SELECT RespondantID, [1]As Q1 ...INTO PivotedTable
Thanks!|||

This was resolved in post:http://forums.asp.net/t/1185101.aspx

Problems with multiple constraints

Hi all,

I am having a problem setting multiple constraints over a table from other table. To be more clear, I have the following code:

ALTER TABLE Solicitud_Servicio

DROP CONSTRAINT FK_Solicitud_Servicio_Domicilio;

ALTER TABLE Solicitud_Servicio

DROP CONSTRAINT FK_Solicitud_Servicio_Domicilio1;

ALTER TABLE Solicitud_Servicio ADD CONSTRAINT

FK_Solicitud_Servicio_Domicilio1 FOREIGN KEY

(

ID_Domicilio_Envio

) REFERENCES Domicilio

(

ID_Domicilio

) ON UPDATE CASCADE;

ALTER TABLE Solicitud_Servicio ADD CONSTRAINT

FK_Solicitud_Servicio_Domicilio FOREIGN KEY

(

ID_Domicilio_Facturacion

) REFERENCES Domicilio

(

ID_Domicilio

) ON UPDATE CASCADE;

As you see, I want an update on the field Domicilio.ID_Domicilio to change the fields Solicitud_Servicio.ID_Domicilio_Envio and Solicitud_Servicio.ID_Domicilio_Facturacion from my point of view there should be no problem and the weird part is that if I try this with only one constraint (either one) it works, as soon as I try to apply the other constraint I get a very annoying

“The referential relationship will result in a cyclical reference that is not allowed”

Maybe Sql Server Mobile 2005 does not support multiple constraints on a table from the same other table?

Thanks,

Flaker

Thats true. SqlCE doesn't support multiple cascade update/delete in this case. How ever it could be one update and one delete.

Thanks

Raja

Problems with multiple constraints

Hi all,

I am having a problem setting multiple constraints over a table from other table. To be more clear, I have the following code:

ALTER TABLE Solicitud_Servicio

DROP CONSTRAINT FK_Solicitud_Servicio_Domicilio;

ALTER TABLE Solicitud_Servicio

DROP CONSTRAINT FK_Solicitud_Servicio_Domicilio1;

ALTER TABLE Solicitud_Servicio ADD CONSTRAINT

FK_Solicitud_Servicio_Domicilio1 FOREIGN KEY

(

ID_Domicilio_Envio

) REFERENCES Domicilio

(

ID_Domicilio

) ON UPDATE CASCADE;

ALTER TABLE Solicitud_Servicio ADD CONSTRAINT

FK_Solicitud_Servicio_Domicilio FOREIGN KEY

(

ID_Domicilio_Facturacion

) REFERENCES Domicilio

(

ID_Domicilio

) ON UPDATE CASCADE;

As you see, I want an update on the field Domicilio.ID_Domicilio to change the fields Solicitud_Servicio.ID_Domicilio_Envio and Solicitud_Servicio.ID_Domicilio_Facturacion from my point of view there should be no problem and the weird part is that if I try this with only one constraint (either one) it works, as soon as I try to apply the other constraint I get a very annoying

“The referential relationship will result in a cyclical reference that is not allowed”

Maybe Sql Server Mobile 2005 does not support multiple constraints on a table from the same other table?

Thanks,

Flaker

Thats true. SqlCE doesn't support multiple cascade update/delete in this case. How ever it could be one update and one delete.

Thanks

Raja