sqloracleplsqloracle-apexapex

how to insert and display true and false icon in apex?


i have a form and report pages, i want to insert a true mark and a false mark in some items i am using oracle sql and plsql how can i do that? the output must be like in the pictureenter image description here


Solution

  • For a classic report and an interactive report, you can use "Column Formatting > HTML Expression" and then format the column according to your needs. The easiest is to use the success/danger color class provided by APEX for your theme. APEX also has its own font set based on "font awesome" called "font APEX". Both can be seamlessly integrated in your report.

    For this example I used the sample EMP/DEPT tables.

    Classic Report AND Interactive Report
    select EMPNO,
           ENAME,
           JOB,
           CASE WHEN job = 'PRESIDENT' THEN 'fa-check' ELSE 'fa-remove' END as icon_class,
           CASE WHEN job = 'PRESIDENT' THEN 'u-success-text' ELSE 'u-danger-text' END as color_class
      from EMP
     where  job in ('MANAGER','PRESIDENT')
    
    Interactive Grid
    select EMPNO,
           ENAME,
           JOB,
           CASE WHEN job = 'PRESIDENT' THEN 'fa-check' ELSE 'fa-remove' END as icon_class,
           CASE WHEN job = 'PRESIDENT' THEN 'u-success-text' ELSE 'u-danger-text' END as color_class
      from EMP
     where  job in ('MANAGER','PRESIDENT')
    
    function(config) {
        config.defaultGridColumnOptions = {
            cellTemplate: '<span aria-hidden="true" class="fa &ICON_CLASS. &COLOR_CLASS."></span>'
        };
        return config;
    }
    

    Note that the syntax is the &COLUMN_NAME. notation in the IG.

    enter image description here

    enter image description here

    enter image description here