What you can do is put an SQL Select in a derived field to do this. THIS IS A VERY VERY ADVANCED TECHNIQUE. You really need to know SQL to do this. I don’t currently have access to ReportSmith so I can’t create or debug this for you.
Some things to know:
Your SQL must be enclosed in parens
Watch out for unprintable characters (like tab, new line etc).
If you code your SQL in some other editor then the derived field editor.
You will need to link your derived field SQL to the fields in your report.
WHERE
(
(“DERIVED_FIELD”.”EMPLID” = “JOB”.”EMPLID”)
AND
(“DERIVED_FIELD”.”EMPL_RCD#” = “JOB”.”EMPL_RCD#”)
AND
(….
Your SQL can ONLY return 1 Value
Use SUM()
I hope this helps a bit. If in doubt you may need to contract this out.
Thanks Charles - This is what I put together. When I test it - it says derived field ok but when I go to run the report it says SQL command not properly ended. I know you said you would not be able to debug it or test it but is there anyone else reading this who might venture a guess? Thanks
SUM((SELECT
TOTAL_GROSS."CK_GROSS"
FROM
PS_AL_CHK_DATA "TOTAL_GROSS"
WHERE
("TOTAL_GROSS"."EMPLID" = "PS_AL_CHK_DATA"."EMPLID")
AND
("TOTAL_GROSS"."EMPL_RCD_NBR" = "PS_AL_CHK_DATA"."EMPL_RCD_NBR")
AND
(TOTAL_GROSS."CK_GROSS" =
(SELECT MAX("INNERALIAS"."CK_GROSS")
FROM
PS_AL_CHK_DATA "INNERALIAS"
WHERE "INNERALIAS"."EMPLID" = "TOTAL_GROSS"."EMPLID"
AND "INNERALIAS"."EMPL_RCD_NBR" = "TOTAL_GROSS"."EMPL_RCD_NBR"
AND "INNERALIAS"."CK_GROSS" = "TOTAL_GROSS"."CK_GROSS"
AND "INNERALIAS"."CHECK_DT" BETWEEN (TO_CHAR ('MM-DD-YYYY','01-01-2009')) AND (TO_CHAR('MM-DD-YYYY','04-27-2009'))))))
(
SELECT
SUM(TOTAL_GROSS."CK_GROSS") AS GROSS
FROM
PS_AL_CHK_DATA "TOTAL_GROSS"
WHERE
(
("TOTAL_GROSS"."EMPLID" = "PS_AL_CHK_DATA"."EMPLID")
AND
("TOTAL_GROSS"."EMPL_RCD_NBR" = "PS_AL_CHK_DATA"."EMPL_RCD_NBR")
)
)
(
SELECT
SUM(TOTAL_GROSS."CK_GROSS") AS GROSS
FROM
PS_AL_CHK_DATA "TOTAL_GROSS"
WHERE
(
("TOTAL_GROSS"."EMPLID" = "PS_AL_CHK_DATA"."EMPLID")
AND
("TOTAL_GROSS"."EMPL_RCD_NBR" = "PS_AL_CHK_DATA"."EMPL_RCD_NBR") AND
("PS_AL_CHK_DATA"."CHECK_DT" BETWEEN 01/01/2009 AND 12/31/2009)
)
)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.