I want to build a report that returns records for a group of employees and by specific dates and supervisor, and renders the report by employee (as in a batch). I am doing this with a main report and 3 subreports. My subreports work individually and I just got one subreport to render from main but only the 1st record in the group displays.
Dataset on main has 3 parameters, USERID, BegDate, EndDate. Dataset on subreport take EMPID, BegDate, EndDate. I inserted subreport on main and subreport parameters as follows:
Name Value
CurEmp =First(Fields!EMPID.Value, "DataSet1")
BegDate [@BegDate]
EndDate [@EndDate]
Where CurEmp
is used in the where clause of DataSet1/sql query i.e. WHERE EMPID = @CurEmp
Main report parameters in DataSet1 are:
Name Value
@USERID [@USERID]
@BegDate [@BegDate]
@EndDate [@EndDate]
Now I realize that the =First
in the Expression in Value
of parameter is supposed to render only the first record but nothing I change it to will render at all. I have done tutorials and googled for 2 days. I can get the simple subreports to work but nothing seems to apply to what I am trying to do. Can someone direct me to an example that applies to my situation?
BTW I have set my VS2008 environment to a Business Inteligence Project.
UPDATE: I have added my sql queries below to help explain per suggestion by @Sam. I actually was starting to look at the fact that maybe I am writing the queries wrong. I am confused about what the main report query should be compared to subquery....I hope this helps to clarify my meaning.
Main report dataset =
SELECT
v.EMPID,
UPPER(p.FirstName + ' ' + p.LastName) as EmpFullName,
v.dtmDate,
v.TCode,
v.Hours,
v.ProjectNo,
from vwPersonSummary v
join tblPerson t on v.EMPID = p.EMPID
WHERE v.USERID = @USERID --Supervisor’s EMPID
AND
v.dtmDate BETWEEN @BegDate AND @EndDate
ORDER BY v.EMPID, v.dtmDate
Subreport dataset=
SELECT
v.EMPID,
UPPER(p.FirstName + ' ' + p.LastName) as EmpFullName,
v.dtmDate,
v.Tcode,
v.Hours,
v.ProjectNo
from vwPersonSummary v
join tblPerson t on v. EMPID = t. EMPID
WHERE
v.EMPID = @CurEmp
AND v.dtmDate BETWEEN @BegDate AND @EndDate
ORDER BY v.dtmDate