Count Records with a not null column [message #588349] |
Tue, 25 June 2013 04:24 |
|
i want to count group above report records!
want to count department group employees there intime is not null!
my report qury
SELECT div.division,
DEP.DEPARTMENT,
DEP.STRENGTH,
E.EMPLOYEECODE,
E.NAME,
DES.DESIGNATION,
E.SHIFT,
I.IDATE,
TO_CHAR(MIN(I.INTIME),'HH:MI AM'),
TO_CHAR(MAX(I.OUTTIME),'HH:MI AM'),
ROUND(SUM(I.BTIME)/60)
FROM HRM_EMPLOYEES E,
HRM_DEPARTMENT DEP,
HRM_DESIGNATION DES,
HRM_INOUT I,
HRM_DIVISION div
WHERE E.EMPLOYEECODE=I.EMPLOYEECODE(+)
AND DEP.DEPARTMENTCODE=E.DEPARTMENTCODE
AND DES.DESIGNATIONCODE=E.DESIGNATIONCODE(+)
and div.divisioncode = e.divisioncode
and (div.divisioncode = :p_divcode or :p_divcode is null)
and (I.idate(+) between :from_date and :to_date )
GROUP BY div.division,DEP.DEPARTMENT,E.EMPLOYEECODE,E.NAME ,DES.DESIGNATION,I.IDATE,e.shift,DEP.STRENGTH
ORDER BY E.EMPLOYEECODE,dep.department;
im doing it with farmula column!
function CF_PRESENTFormula return Number is
v_emps number;
begin
select count(1)
into v_emps
from hrm_employees e,hrm_inout i
where e.employeecode=I.employeecode
and i.intime=:TO_CHAR_MIN_I_INTIME_HH_MI_AM
and :TO_CHAR_MIN_I_INTIME_HH_MI_AM is not null;
return v_emps;
end;
please help im new in this field!
|
|
|
|
|
|
Re: Count Records with a not null column [message #588383 is a reply to message #588380] |
Tue, 25 June 2013 07:52 |
|
SELECT div.division,
DEP.department,
DEP.strength,
E.employeecode,
E.name,
DES.designation,
E.shift,
I.idate,
To_char(Min(I.intime), 'HH:MI AM'),
To_char(Max(I.outtime), 'HH:MI AM'),
Round(SUM(I.btime) / 60)
FROM hrm_employees E,
hrm_department DEP,
hrm_designation DES,
hrm_inout I,
hrm_division div
WHERE E.employeecode = I.employeecode(+)
AND DEP.departmentcode = E.departmentcode
AND DES.designationcode = E.designationcode(+)
AND div.divisioncode = e.divisioncode
AND ( div.divisioncode = :p_divcode
OR :p_divcode IS NULL )
AND ( I.idate(+) BETWEEN :from_date AND :to_date )
GROUP BY div.division,
DEP.department,
E.employeecode,
E.name,
DES.designation,
I.idate,
e.shift,
DEP.strength
ORDER BY E.employeecode,
dep.department;
i want to a farmula column that return records that dont have intime!
these are in department group!
i want to show them as present!
and i want to show "------" when intime is null;
-
Attachment: untitled.JPG
(Size: 33.29KB, Downloaded 3275 times)
|
|
|
Re: Count Records with a not null column [message #588390 is a reply to message #588380] |
Tue, 25 June 2013 08:38 |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
cookiemonster wrote on Tue, 25 June 2013 13:16Read the 2nd link in Michel's post above.
And then follow the instructions it contains. Ignoring requests from the moderators to follow the rules isn't a great way to get help.
|
|
|
Re: Count Records with a not null column [message #588469 is a reply to message #588390] |
Wed, 26 June 2013 02:17 |
|
SELECT div.division,
DEP.department,
DEP.strength,
E.employeecode,
E.name,
DES.designation,
E.shift,
I.idate,
To_char(Min(I.intime), 'HH:MI AM'),
To_char(Max(I.outtime), 'HH:MI AM'),
Round(SUM(I.btime) / 60)
FROM hrm_employees E,
hrm_department DEP,
hrm_designation DES,
hrm_inout I,
hrm_division div
WHERE E.employeecode = I.employeecode(+)
AND DEP.departmentcode = E.departmentcode
AND DES.designationcode = E.designationcode(+)
AND div.divisioncode = e.divisioncode
AND ( div.divisioncode = :p_divcode
OR :p_divcode IS NULL )
AND ( I.idate(+) BETWEEN :from_date AND :to_date )
GROUP BY div.division,
DEP.department,
E.employeecode,
E.name,
DES.designation,
I.idate,
e.shift,
DEP.strength
ORDER BY E.employeecode,
dep.department;
i want a farmula column that return records that dont have intime!
like in screan below and i want to show "------" when intime is null i did it in property "value if null"
these are in department group!
i want to show them as present!
-
Attachment: untitled.JPG
(Size: 33.29KB, Downloaded 3282 times)
|
|
|
|
Re: Count Records with a not null column [message #588485 is a reply to message #588475] |
Wed, 26 June 2013 03:16 |
|
no i just want to count how manay employee has intime!
i don't want to count those have null intime,
and also i want to disply value"-----" if there in time is null,
i did it in property "value if null"
in image it is showing 3 present they have intime
i use a summery column to count intime, if i use value if null then it shows all seven present!
|
|
|
|
|
|
|
|
Re: Count Records with a not null column [message #589400 is a reply to message #589317] |
Fri, 05 July 2013 04:44 |
|
results are not accurate?
FUNCTION Cf_presentformula
RETURN NUMBER
IS
v_present NUMBER;
BEGIN
SELECT Count(1)
INTO v_present
FROM hrm_employees E,
hrm_department D,
hrm_inout I
WHERE D.departmentcode = E.departmentcode
AND E.employeecode = I.employeecode
AND I.employeecode = :EMPLOYEECODE
AND E.employeecode = :EMPLOYEECODE
AND D.department = :DEPARTMENT
AND I.intime IS NOT NULL;
RETURN v_present;
EXCEPTION
WHEN OTHERS THEN
RETURN NULL;
END;
|
|
|
|
|
|
|