I'm trying to create a report and am getting "Report item expressions can
only refer to fields within the current data set scope or, if inside an
aggregate, the specified data set scope."
I have a tableadaptor and a dataset and the query that fills the dataset has
a couple joins and a Union All in it. When the dataset is expanded in the
Data Sources it shows the correct fields. If I drag any of the first four
fields onto the report the report will generate just fine, but if I drag any
of the other fieds onto the report I get the build error listed above. I've
been banging my head against this for two days now, so ANY ideas are most
welcome.
Since I know that some of you will want to see the query.....
SELECT sysinfo.agencyname, clients.fname, clients.mname, clients.lname,
clients.clientno, ai.ddate, ai.witfirst, ai.witlast, ai.doctor, ai.nurse, ai.
toldparent,
ai.toldadvoca, ai.sublocatio, ai.account, ai.ttime, ai.
location, ai.nature, ai.aggfirst, ai.agglast, ai.place, ai.repobyfirs, ai.
repobylast, ai.response, ai.tpm,
ai.dnnotes, ai_injur.bodypart, ai_injur.severity,
ai_injur.injurytype, ai_injur.ai_key, ai.ddate AS Expr1
FROM sysinfo CROSS JOIN
ai_injur LEFT OUTER JOIN
ai ON ai.ai_key = ai_injur.ai_key LEFT OUTER JOIN
clients ON ai.client_key = clients.client_key
WHERE (clients.is_current = 1)
UNION ALL
SELECT sysinfo.agencyname, clients.fname, clients.mname, clients.lname,
clients.clientno, ai.ddate, ai.witfirst, ai.witlast, ai.doctor, ai.nurse, ai.
toldparent,
ai.toldadvoca, ai.sublocatio, ai.account, ai.ttime, ai.
location, ai.nature, ai.aggfirst, ai.agglast, ai.place, ai.repobyfirs, ai.
repobylast, ai.response, ai.tpm,
ai.dnnotes, 'none' AS BODYPART, 'none' AS SEVERITY,
'none' AS INJURYTYPE, ai.ai_key, ai.ddate AS Expr1
FROM sysinfo CROSS JOIN
ai LEFT OUTER JOIN
ai_injur ON ai.ai_key = ai_injur.ai_key LEFT OUTER JOIN
clients ON ai.client_key = clients.client_key
WHERE (clients.is_current = 1) AND (ai_injur.ai_key IS NULL)
--
Message posted via http://www.dotnetmonster.com