Sign Up

❇️ OrclQA.Com is a question and answer forum for programmers.
❇️ Here anyone can ask questions and anyone can answer to help others.
❇️ It hardly takes a minute to sign up and it is 100% FREE.

Have an account? Sign In


Have an account? Sign In Now

Sign In


Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.


Have an account? Sign In Now

Sorry, you do not have a permission to ask a question, You must login to ask question.


Forgot Password?

Need An Account, Sign Up Here
Sign InSign Up

Oracle APEX Tutorials & Forum

Oracle APEX Tutorials & Forum Logo Oracle APEX Tutorials & Forum Logo

Oracle APEX Tutorials & Forum Navigation

  • Home
  • Oracle Apex
  • PL/SQL
  • SQL
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Ask Question
  • Write a Tutorial
  • Tools
    • Oracle Table Script Generator
    • PL/SQL Package Generator
  • Users
  • Tags
  • FAQs
  • Badges
  • Home
  • Oracle Apex
  • PL/SQL
  • SQL
pavlos
pavlos

pavlos

  • 37 Questions
  • 107 Answers
  • 1 Best Answer
  • 376 Points
View Profile
  • 0
pavlosGuru
Asked: November 28, 20202020-11-28T15:54:25+05:30 2020-11-28T15:54:25+05:30

How to highlight row based on condition using Classic Report

  • 0

Hi!

I use nested report with two Classic Reports, how can I use highlight based on column value for both?.

Thanks in advance!

oracle apex
  • 14
  • 2k
  • 1
  • 0
  • Share
    • Share on Facebook
    • Share on Twitter
    • Share on LinkedIn
Answer

14 Answers

  1. afzal

    afzal

    • India
    • 1 Question
    • 50 Answers
    • 3 Best Answers
    • 319 Points
    View Profile
    afzal Guru
    2020-11-29T15:33:58+05:30Added an answer on November 29, 2020 at 3:33 pm

    step -1
    give class name for your report like-- emp
    at report region , appearance section "CSS Classes" => emp

    step -2
    create a dynamic action at page load
    action == execute javascript code
    like--
    //-- replace your conditional column with "DEPTNO", AND ALSO REPLACE TEXT =='10' WITH YOUR CONTENT
    $('.emp [headers=DEPTNO]').each(function(){
    console.log($(this).text());
    var text=$(this).text();
    if (text == '10'){
    $(this).closest("tr").children().css({"background-color":"red"});
    }
    });

    • 1
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
    • pavlos

      pavlos

      • 37 Questions
      • 107 Answers
      • 1 Best Answer
      • 376 Points
      View Profile
      pavlos Guru
      2020-11-29T19:59:19+05:30Replied to answer on November 29, 2020 at 7:59 pm
      This answer was edited.

      Thanks a lot!

      It works for parent region, but doesn't work for nested child region.

      I would like to disable hover, background color is changed to default when mouse is over highlighted row

      • 0
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
      • afzal

        afzal

        • India
        • 1 Question
        • 50 Answers
        • 3 Best Answers
        • 319 Points
        View Profile
        afzal Guru
        2020-11-30T10:19:15+05:30Replied to answer on November 30, 2020 at 10:19 am

        Hi pavlos,

        are you using plugging for nested report ?

         

         

         

        • 0
        • Share
          Share
          • Share on Facebook
          • Share on Twitter
        • pavlos

          pavlos

          • 37 Questions
          • 107 Answers
          • 1 Best Answer
          • 376 Points
          View Profile
          pavlos Guru
          2020-12-03T01:32:56+05:30Replied to answer on December 3, 2020 at 1:32 am
          This answer was edited.

          I created nested report manually.

          • 0
          • Share
            Share
            • Share on Facebook
            • Share on Twitter
  2. pavlos

    pavlos

    • 37 Questions
    • 107 Answers
    • 1 Best Answer
    • 376 Points
    View Profile
    pavlos Guru
    2021-01-23T15:23:13+05:30Added an answer on January 23, 2021 at 3:23 pm
    This answer was edited.

    Hi!

    How can I compare date column with JavaScript?
    I want to change row color where date is less than current date.

    • 0
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
    • Vinish Kapoor

      Vinish Kapoor

      • 1 Question
      • 727 Answers
      • 62 Best Answers
      • 4k Points
      View Profile
      Vinish Enlightened
      2021-01-24T07:27:08+05:30Replied to answer on January 24, 2021 at 7:27 am

      Create a dynamic action as Style type and specify the JavaScript expression for the dynamic action as following:

      new Date($v("P1_yourdate")).getTime() < new Date($v("P1_CURRDATE")).getTime()

      Here the P1_yourdate is the item with which you want to compare with the current date. Also, create an item P1_currdate and on page load assign the current date to it.

      • 0
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
      • pavlos

        pavlos

        • 37 Questions
        • 107 Answers
        • 1 Best Answer
        • 376 Points
        View Profile
        pavlos Guru
        2021-01-24T14:02:23+05:30Replied to answer on January 24, 2021 at 2:02 pm
        This answer was edited.

        How can I get vales into :P1_yourdate for all rows and compare them?

        • 0
        • Share
          Share
          • Share on Facebook
          • Share on Twitter
        • Vinish Kapoor

          Vinish Kapoor

          • 1 Question
          • 727 Answers
          • 62 Best Answers
          • 4k Points
          View Profile
          Vinish Enlightened
          2021-01-25T06:19:08+05:30Replied to answer on January 25, 2021 at 6:19 am

          For all rows? It seems you want to compare the date in the interactive grid. Then you just need to refer the IG column (:YOURDATE) instead of the page item (P1_yourdate).

          • 1
          • Share
            Share
            • Share on Facebook
            • Share on Twitter
          • pavlos

            pavlos

            • 37 Questions
            • 107 Answers
            • 1 Best Answer
            • 376 Points
            View Profile
            pavlos Guru
            2021-01-29T00:42:46+05:30Replied to answer on January 29, 2021 at 12:42 am

            Sorry for bad explanation, I want to compare data in the Classic Report.

            • 0
            • Share
              Share
              • Share on Facebook
              • Share on Twitter
  3. afzal

    afzal

    • India
    • 1 Question
    • 50 Answers
    • 3 Best Answers
    • 319 Points
    View Profile
    afzal Guru
    2021-01-25T10:14:33+05:30Added an answer on January 25, 2021 at 10:14 am

    step 1---
    report query like--
    select EMPNO,
    ENAME,
    JOB,
    MGR,
    HIREDATE,
    SAL,
    COMM,
    DEPTNO,
    to_date(to_char(sysdate,'dd-mm-yyyy'),'dd-mm-yyyy')-to_date(to_char(HIREDATE,'dd-mm-yyyy'),'dd-mm-yyyy') as dummy
    from EBA_DEMO_CHART_EMP
    step-2 column-name-- HIREDATE
    KEEP HTML EXPRESSION LIKE -- <span data-id=#DUMMY#>#HIREDATE#</span>
    step-3 make dummy column as hidden column

    step-4
    give class name for your report like– emp
    at report region , appearance section “CSS Classes” => emp

    step-5
    create a dynamic action at page load
    action == execute javascript code
    like–
    //– replace your conditional column with HIREDATE

    $('.emp [headers="HIREDATE"]').each(function(index,element){
    var x= element.innerHTML;
    //console.log($(element).children().attr('data-id'));
    var text= parseInt($(element).children().attr('data-id'));

    if (text > 1){
    $(this).closest("tr").children().css({"background-color":"red"});
    }
    });

    • 1
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
    • pavlos

      pavlos

      • 37 Questions
      • 107 Answers
      • 1 Best Answer
      • 376 Points
      View Profile
      pavlos Guru
      2021-01-29T00:40:22+05:30Replied to answer on January 29, 2021 at 12:40 am

      Thanks a lot, it works. But, I am using faceted search with checkbox group, and when I filter column using checkboxes, rows aren't highlighted.

      • 0
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
      • afzal

        afzal

        • India
        • 1 Question
        • 50 Answers
        • 3 Best Answers
        • 319 Points
        View Profile
        afzal Guru
        2021-01-31T16:44:33+05:30Replied to answer on January 31, 2021 at 4:44 pm

        create a dynamic action
        "after refresh" report region
        action == execute javascript code
        like–
        //– replace your conditional column with HIREDATE

        $(‘.emp [headers=”HIREDATE”]’).each(function(index,element){
        var x= element.innerHTML;
        //console.log($(element).children().attr(‘data-id’));
        var text= parseInt($(element).children().attr(‘data-id’));

        if (text > 1){
        $(this).closest(“tr”).children().css({“background-color”:”red”});
        }
        });

        • 1
        • Share
          Share
          • Share on Facebook
          • Share on Twitter
        • pavlos

          pavlos

          • 37 Questions
          • 107 Answers
          • 1 Best Answer
          • 376 Points
          View Profile
          pavlos Guru
          2021-02-05T21:05:53+05:30Replied to answer on February 5, 2021 at 9:05 pm

          Thanks a lot afzal, works 🙂

          • 2
          • Share
            Share
            • Share on Facebook
            • Share on Twitter
  4. goto150

    goto150

    • Wroclaw, Poland
    • 0 Questions
    • 19 Answers
    • 4 Best Answers
    • 161 Points
    View Profile
    goto150 Professional
    2021-01-30T06:49:09+05:30Added an answer on January 30, 2021 at 6:49 am
    This answer was edited.

    It's going to be a variation of the above:

    1. Click on HIREDATE column name
      1. Column Formatting
        1. HTML Expression = <span name="nHIREDATE">#HIREDATE#</span>
    2. In Dynamic Action tab right click on Events --> Create Dynamic Action
      1. Identification
        1. Name = Set style on refresh
      2. When
        1. Event = After Refresh
        2. Selection Type = Region
        3. Region = /your region name/
    3. True Action
        1. Identification
          1. Action = Execute Java Script Code
        2. Settings --> Code:
    var cell_hiredate = document.getElementsByName("nHIREDATE");
    cell_hiredate.forEach(function(row){
    //I use "9/28/1981" to get some variety for the test case, you will use Date()...
    if (Date.parse(row.innerText.toString()) > Date.parse("9/28/1981")){
    //.parentElement.parentElement. to get you at the row level
    //.parentElement. single parrent will get you at the cell level 
    row.parentElement.parentElement.style.setProperty("background-color", "#daf0ba"); 
    }
    }
    );
    1. Fire on Initialization = TRUE if you want the action to fire when the page loads
    • 2
    • Share
      Share
      • Share on Facebook
      • Share on Twitter

You must login to can add an answer.


Forgot Password?

Sidebar

Explore

  • Ask Question
  • Write a Tutorial
  • Tools
    • Oracle Table Script Generator
    • PL/SQL Package Generator
  • Users
  • Tags
  • FAQs
  • Badges

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
© 2022 OrclQA.Com. All Rights Reserved.
Privacy Policy - About Us