This discussion is archived
7 Replies Latest reply: Oct 22, 2012 3:49 PM by lxiscas RSS

Can we disable link in a classic report according to row content?

lxiscas Newbie
Currently Being Moderated
Hi, guys:

I have a question: I have a classic report, which has a column of link to another page in the same application; the link shows icon of Google map, user can see a Google map of the address listed in the same row of this report by clicking this link. However, some addresses are empty, so we want to disable the link in the column whenever the address in the same row is empty. We tried with all of APEX settings regarding column, but not successful. Could anyone help us on this problem?

so I have a further question is: is there anyway that we can manipulate APEX report content in PL/SQL code?


Thanks.

Sam
  • 1. Re: Can we disable link in a classic report according to row content?
    tread Explorer
    Currently Being Moderated
    You can enter html and javascript into a classic report column (just got to make sure the column is displayed as Standard Report Column).

    something like:
    select column1, column2,
    nvl2(column3,'<a id="id" href="#"><img src="/images/location/icon.png"</img></a>','NULL TEXT') "COLUMNALIAS"
    from table 1
    of course you can add an onclick event to meet your needs too (wasn't showing up in code brackets):

    onclick="javascript:apex.confirm(''Confirm Message'',{request:''PAGE_REQUEST'',set:{''P1_PAGE_ITEM'':'||column3||'}});"

    Ricker

    Edited by: tread on Oct 17, 2012 4:35 PM
  • 2. Re: Can we disable link in a classic report according to row content?
    Paul Broughton Pro
    Currently Being Moderated
    Hi Sam,

    I'm presuming you use the same link image or text each time. The way I tend to do it is use a case statement in my query such as below:
     select
      t.id as id,
      t.user_id,
      case
        when (select count(*)
          from ae_team te
          where te.user_id = t.user_id >= 1
        then '<img src="/images/apple_time_machine_shaped.png" width="16px" height="16px" alt="">'
          else null
        end as ae_team_history
    from ae_team t
    This query is just an example to show to look for history in the table and isn't tested. When entering the column link information you would add #AE_TEAM_HISTORY# column name in the "Link Text" then fill out the rest of the details as normal. This will then only show the link when the condition in the case statement is met.

    Hope this helps

    Paul
  • 3. Re: Can we disable link in a classic report according to row content?
    lxiscas Newbie
    Currently Being Moderated
    Hi, Paul:

    Thanks your help! I checked the report with firebug, and found it is like this:
    <img a="" \<="" src="wwv_flow_file_mgr.get_file?p_security_group_id=18568811800631432&amp;p_fname=location.png">
    so my question is : shall I output the image as this way if the other column in the same row, say, geocoding is not null? I am afraid of p_security_group_id is dynamic, if I hard code it in target list of query, it may cause problem.
  • 4. Re: Can we disable link in a classic report according to row content?
    lxiscas Newbie
    Currently Being Moderated
    Hi,Paul:


    I tried with your query:
    select distinct 
    (case when (to_char(sl.ADDRESS1_LATITUDE) is null) and (to_char(sl.physical_address_latitude) is null) then null
     else '<img src="#WORKSPACE_IMAGES#location.png"\'
     end) MAP_link,
    ......
    and I set this column with column link text:

    #MAP_LINK#

    but it shows not the image icon (link is working though), but the text itself as
    <a href="f?p=2001:3006:1633012192639501::NO:RP:YES:28F8F2C91B88<a href="f?p=2001:3006:1633012192639501::NO:RP:YES:4B58FD640A235491C077B36E20B0409A">&lt;img src="wwv_flow_file_mgr.get_file?p_security_group_id=18568811800631432&amp;p_fname=location.png"\</a>
    {code}
    
    if  I use query 
    
    {code}
    select distinct 
    (case when (to_char(sl.ADDRESS1_LATITUDE) is null) and (to_char(sl.physical_address_latitude) is null) then null
     else '<img src="#WORKSPACE_IMAGES#location.png"\image>'
     end) MAP_link,
    ...
    {code}
    
    the column map_link is empty. I guess I do not know how to escape characters in javascript. Could you help me on this?
    
    Thanks.
    
    Sam                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
  • 5. Re: Can we disable link in a classic report according to row content?
    fac586 Guru
    Currently Being Moderated
    >
    <img a="" \<="" src="wwv_flow_file_mgr.get_file
    {code}
    {code}
    else '<img src="#WORKSPACE_IMAGES#location.png"\image>'
    {code}
    What's with <tt>\&lt;=""</tt> and <tt>\image&gt;</tt>? The HTML <a href="http://reference.sitepoint.com/html/img"><tt>img</tt></a> element is self-closing (and requires an <tt>alt</tt> attribute), in HTML syntax:
    {code}
    <img src="#WORKSPACE_IMAGES#location.png" alt="">
    {code}
    or XHTML syntax:
    {code}
    <img src="#WORKSPACE_IMAGES#location.png" alt="" />
    {code}
    I tried with your query:

    {code}
    select distinct
    (case when (to_char(sl.ADDRESS1_LATITUDE) is null) and (to_char(sl.physical_address_latitude) is null) then null
    else '<img src="#WORKSPACE_IMAGES#location.png"\'
    end) MAP_link,
    ......
    {code}

    and I set this column with column link text:

    #MAP_LINK#

    but it shows not the image icon (link is working though), but the text itself as

    {code}
    <a href="f?p=2001:3006:1633012192639501::NO:RP:YES:28F8F2C91B88&lt;img src="wwv_flow_file_mgr.get_file?p_security_group_id=18568811800631432&amp;p_fname=location.png"\

    Set the Display Text As report column attribute to Standard Report Column rather than the default Display as Text (escape special characters).
    I guess I do not know how to escape characters in javascript.
    There's no JavaScript here.
  • 6. Re: Can we disable link in a classic report according to row content?
    lxiscas Newbie
    Currently Being Moderated
    Hi, Paul:

    I changed the query as you said:
    select distinct 
    (case when (to_char(sl.ADDRESS1_LATITUDE) is null) and (to_char(sl.physical_address_latitude) is null) then null
     else '<img src="#WORKSPACE_IMAGES#location.png" alt="">'
     end) MAP_link,
    ...
    and set the Display As column attribute of this column as standard report column as you said, but the column shows empty. none of rows has any image icon.

    Sam
  • 7. Re: Can we disable link in a classic report according to row content?
    lxiscas Newbie
    Currently Being Moderated
    fac586:

    Than you! Your idea really saved me! My solution is slightly differently form yours:
    select distinct 
    (case when (to_char(sl.ADDRESS1_LATITUDE) is null) and (to_char(sl.physical_address_latitude) is null) then null
     else '<img src="#WORKSPACE_IMAGES#location.png\">'
     end) MAPL,
    ...
    I also need to set the following things:
    column attribute of MAPL: Display AS: standard report column

    report attributes: strip HTML:No

    Edited by: lxiscas on Oct 22, 2012 3:48 PM

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points