Monday, 2 January 2017

APEX Reports with dynamic help text in Oracle APEX 4.2 using CSS


Objective:

To show dynamic help text in APEX reports (Interactive/classical) in Oracle APEX 4.2 using CSS.

Solution:

Step 1: Create Interactive report

Step 2: Use below query in IR Region source.

<<SQL Begins>>

SELECT
  *
FROM
  (
    SELECT
      ROWNUM LEVEL_VALUE ,
      UPPER(TARGET) TARGET,
      STARTED_BY
    FROM
      (
        SELECT
          ('<span style="cursor:help" title="'
          || UPPER(REPORTNAME)
          || '">'
          || (
            CASE
              WHEN AA.SUB_PAGEID !=:APP_PAGE_ID
              THEN '<a href="'
                ||'f?p=&APP_ID.:'
                ||AA.SUB_PAGEID
                ||':'
                || :APP_SESSION
                ||':::'
                ||AA.SUB_PAGEID
                ||':">'
                ||INITCAP(AA.SUBTABNAME)
                ||' </a>'
              ELSE '<font color=purple>'
                ||INITCAP(AA.SUBTABNAME)
                ||'</font>'
            END)
          || '</span>') AS TARGET,
          TRIM(UPPER(AA.SUBTABNAME)) REP_ORD ,
          AB.MAKER_ID AS "STARTED_BY"
        FROM
          REP_DEPT_REPORT_MAP_DETAILS AA,
          DS_REP_REPORT_MASTER AB
        WHERE
          AA.REPID IN
          (
            SELECT DISTINCT
              RSD.REPORTID
            FROM
              REP_ROLE_DEPT_REPORT_MAP RSD,
              REP_ROLE_DEPT_MAP RD,
              REP_USER_MASTER UM,
              REP_USER_ROLE_MAP UD,
              REP_ROLE_MASTER RM,
              REP_DEPARTMENT_SUB_MASTER DSM,
              REP_DEPT_REPORT_MAP_DETAILS REPTD,
              REP_ROLE_DEPT_SUB_MAP RRDSM,
              DS_REP_REPORT_MASTER DRP
            WHERE
              RSD.DEPTID               =RD.DEPTID
            AND TRIM(UPPER(UM.USER_ID))=TRIM(UPPER(:P0_USERID))
            AND UM.USER_ID             =UD.USER_ID
            AND RD.ROLEID              =UD.ROLEID
            AND RSD.ROLE_ID            =UD.ROLEID
            AND RM.ROLE_ID             =UD.ROLEID
            AND DSM.DEPT_SUBID         =REPTD.STABID
            AND RRDSM.DEPT_SUBID=DSM.DEPT_SUBID
            AND RM.ROLE_ID      =RRDSM.ROLEID
            AND RSD.REPORTID=REPTD.REPID
            AND DRP.REPID   =REPTD.REPID
            AND DRP.RSTATUS LIKE 'C'
            AND TRUNC(SYSDATE) = TRUNC(DRP.ENDTIME)
          )
        AND AA.REPID=AB.REPID
        ORDER BY
          AB.ENDTIME DESC
      )
  );


<<SQL Begins>>



By
Karkuvelraja T

No comments:

Post a Comment