1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

How to restrict a column to display value if value exists

Discussion in 'Oracle Application Express (APEX)' started by Bharat, Jun 4, 2014.

  1. Bharat

    Bharat Community Moderator Forum Guru

    Messages:
    1,747
    Likes Received:
    147
    Trophy Points:
    1,805
    Location:
    Vijayawada, India
    Hi All,

    We have developed an APEX Report with 10 columns. For the last column we provided an image to display at Link Text Field under Column Link Section for that column. Now if we have values only for 2 records in overall 10 records the image has to show only for those 2 records instead of showing to all the records. But, the report now is showing with image for all the rows (10 records). Can anyone please guide us to achieve this.
     
  2. ocprep

    ocprep Forum Advisor

    Messages:
    277
    Likes Received:
    76
    Trophy Points:
    410
    Location:
    Orlando, Florida
    I have used a DECODE in my queries to selectively show images in a report using logic like the following. the 'code_check' column is 1 when a code exists in the table and zero otherwise. The two DECODEs below will show a red X (which calls javascript to remove the code) when one exists or a green + which calls a javascript function to add the code if it does not. Obviously calling a javasciprt function is not required... it's just the example I had handy.

    DECODE(code_check, 1, '<a href="javascript:DropCode(''' || code_id || ''')"><img src="/i/FNDCANCE.gif" alt="Remove code." /></a>', NULL) AS DROP_CODE

    DECODE(code_check, 1, NULL, '<a href="javascript:AddCode(''' || code_id || ''')"><img src="/i/FNDADD11.gif" alt="Add code." /></a>') AS ADD_CODE
     
  3. Bharat

    Bharat Community Moderator Forum Guru

    Messages:
    1,747
    Likes Received:
    147
    Trophy Points:
    1,805
    Location:
    Vijayawada, India
    Hi Matthew,

    Yes the case statement works successfully in the Query level to restrict not to display images if value not exists and to display images if value exists.