Custom Query Help

Wednesday, April 17, 2013
Avatar

Hi, I've written the following custom query but am having trouble getting the Count values for my requirments and incidents, as what is returned is  'System.Data.Query.ResultAssembly.BridgeDataReader' instead of an integer value.

Any idea how I can get this to work?

Thank you!

select R.CUST_05 AS IMPLEMENTATION_DATE, R.PROJECT_NAME, R.NAME AS RELEASE_NAME, R.RELEASE_ID, R.TASK_ESTIMATED_EFFORT AS ESTIMATED_EFFORT, R.TASK_ACTUAL_EFFORT AS ACTUAL_EFFORT,
(select value count(S.INCIDENT_ID) from SpiraTestEntities.R_Incidents as S where  S.DETECTED_RELEASE_ID = R.RELEASE_ID) AS INCIDENT_COUNT,
(select value count(Q.REQUIREMENT_ID) from SpiraTestEntities.R_Requirements as Q where R.RELEASE_ID = Q.RELEASE_ID && (NOT Q.IS_DELETED) && (Q.IMPORTANCE_ID = 1) && (NOT(Contains(Q.DESCRIPTION, 'AUDIT')))) AS REQUIREMENT_COUNT
from SpiraTestEntities.R_Releases as R
where (R.PROJECT_GROUP_ID = 19) && (R.ACTIVE_YN = 'Y') && (Cast(R.CUST_05 as DateTime) BETWEEN  AddDays(CurrentDateTime(), -7) AND AddDays(CurrentDateTime(), 0))
order by R.PROJECT_NAME, RELEASE_NAME

2 Replies
Thursday, April 18, 2013
Avatar
re: vsmith Wednesday, April 17, 2013

Follow-up: I got this to work by adding ANYELEMENT as a wrapper to my query.

For example:

ANYELEMENT(select value count(Q.REQUIREMENT_ID) from SpiraTestEntities.R_Requirements as Q where R.RELEASE_ID = Q.RELEASE_ID && (NOT Q.IS_DELETED) && (Q.IMPORTANCE_ID = 1) && (NOT(Contains(Q.DESCRIPTION, 'AUDIT')))) AS REQUIREMENT_COUNT

returns me a value of 11, which is correct!

Thursday, April 18, 2013
Avatar
re: vsmith Thursday, April 18, 2013
Thanks for reposting the query with the answer.
Statistics
  • Started: Wednesday, April 17, 2013
  • Last Reply: Thursday, April 18, 2013
  • Replies: 2
  • Views: 1635