Report Column as link or normal text based on SQL result

Hi all,
I would like to achieve the following:
I have a report based on a PL/SQL function returning SQL query.
The first column contains an ID (i.e. a number)
If this number is contained in a nother table.field this column in this row shall be a link to another page incl. item assignments.
If this is not the case, it shall be displayed as normal text.
Example:
TABLE1.ID = 123456
IF SELECT count(*) FROM TABLE2 WHERE ID = TABLE1.ID > 1 then
show column as link
ELSE
show column as text
ENDIF.
Does anyone have a solution for this?
Thanks and best regards.
KMC

Hi,
You could achieve that by creating the HTML tags required in the SQL statement itself:
SELECT ...
CASE WHEN .... THEN '<a href="f?p=.....">'|| FIELDNAME || '</a>' ELSE FIELDNAME END FIELDNAME,
FROM ...Of course, this would mean that the column shouldn't be sortable by the user
Andy

Similar Messages

  • Creating Region & Items Dynamically based on SQL Result

    Hi,
    I need to create regions dynamically during runtime based on SQL.
    So the number of regions and title will depends on the SQL result.
    I came accross the PLSQL Dynamic Content region type. I searched in the internet, I could not find a matching example.
    I looked at the APEX book, it mentions about 'Creating a Matrix of Fields Programmatically' but It's not very descriptive and it's using www_flow_api which i couldn't find documentation about it.
    So I am turning into this forum for help.
    Can you guys guide me to dynamically create region in a page?
    for e.g
    If my sql returns 5 records, I need to create 5 regions. Each region will contain a dynamically created tabular form as well depending on another SQL (from table function).
    Please let me know if I am not being clear about my question.
    Thanks a lot in advance.

    hello,
    I have the following SQL statement in my region.
    SELECT APEX_ITEM.DISPLAY_AND_SAVE(1,rectype) rectype,
           APEX_ITEM.DISPLAY_AND_SAVE(2,class_id) class_id,
           APEX_ITEM.DISPLAY_AND_SAVE(3,attribute_id) attribute_id,
           decode(rectype,1,'<p style="font-size:17px;color:white;background-color:#383838">'||title||'</p>',
                          2,'<p><b><i><big>'||title||'</b></i></big></p>',
                          3,replace(title,chr(13)||chr(10),'</br>'),
                          apex_item.textarea(4,title,5,200)) title,
           decode(rectype,1,'<p style="font-size:17px;color:white;background-color:#383838">'||review1st||'</p>',
                          2,apex_item.text(5,review1st,3,3),
                          3,APEX_ITEM.SELECT_LIST_FROM_LOV(5,review1st,'ARTIST_RANK',null,'NO'),
                          apex_item.hidden(5,review1st)) review1st,
           decode(rectype,1,'<p style="font-size:17px;color:white;background-color:#383838">'||review2nd||'</p>',
                          2,apex_item.text(6,review2nd,3,3),
                          3,APEX_ITEM.SELECT_LIST_FROM_LOV(6,review2nd,'ARTIST_RANK',null,'NO'),
                          apex_item.hidden(6,review2nd)) review2nd
      FROM TABLE (pkg_artist_review.f_artist_review (:P21_ARTIST_SEQ, :P21_ARTIST_DISCIPLINE,:P21_REVIEW_YEAR))as you can see I use DECODE because I need to do HTML formatting on the value and create ITEM according to the value of 'rectype'
    decode(rectype,1,'<p style="font-size:17px;color:white;background-color:#383838">'||title||'</p>',
                          2,'<p><b><i><big>'||title||'</b></i></big></p>',
                          3,replace(title,chr(13)||chr(10),'</br>'),
                          apex_item.textarea(4,title,5,200)) title, so the report result would look like
    rectype                  title
    [display f01]          title
    [display f01]          title
    [display f01]          title
    [display f01]          [text area f04]My question is :
    I would think my array list f01 and f04 will have different number of values inside.
    f01 will have 4 value, whereas f04 will only have 1.
    I tried to use
    decode(rectype,1,APEX_ITEM.DISPLAY_AND_SAVE(4,'<p style="font-size:17px;color:white;background-color:#383838">'||title||'</p>'),
                          2,APEX_ITEM.DISPLAY_AND_SAVE(4,'<p><b><i><big>'||title||'</b></i></big></p>'),
                          3,APEX_ITEM.DISPLAY_AND_SAVE(4,replace(title,chr(13)||chr(10),'</br>')),
                          apex_item.textarea(4,title,5,200)) title, I only ended up having the HTML code written to the report.
    How can I handle such situation?
    I need my array list to have the same number of records thus i could just use one index to iterate through the value.
    Thanks in advance.
    Edited by: joel2 on Mar 18, 2009 3:40 PM

  • How to provide a LINK on normal TEXT field in read only mode

    Hi,
    I have a TEXT item and that is used for only url purpose.
    so a user can enter something like http://www.abc.com in that field.
    So when I am in read only mode for that item, I want a link also on that text..
    how can I do that.
    thanks,
    Deepak

    You could create a pl/sql expression computation on the TEXT item which will convert the value shown for the field to be a HTML link
    '<a href="http:// ' || :PXX_TEXT || '">' || :pXX_TEXT || '</A>';Make the computation conditional using the same condition as is used to render the item as read-only
    varad

  • Report text based on test results

    I would like to include debug information in the TestStand report.  For example, if test fails, report text = "Try replacing C1."  Is there one expression that would cover all types of tests?  I'm using TestStand 3.5.  Thanks.
    Solved!
    Go to Solution.

    One idea is that you could use the step's additional results.  Just put a debug message as one of the ideas and then set the Condition to Step.Results.Status == "Failed".  Then it will only show if the step fails.
    Just a thought.
    jigg
    CTA, CLA
    teststandhelp.com
    ~Will work for kudos and/or BBQ~

  • Bug: Report Column based on LOV character string buffer too small error

    When using a column type of "Display as Text (based on LOV, does not save state)" with a result set that is rather large causes a character or string buffer too small oracle error.
    See the below page for an example.
    The example page below has a single report off a table called "HUGE_TABLE" which has two columns: display and code
    Code contains a number between 0 and 100000.
    Display contains the number in code appended to a block of text.
    When I display the report with no Display As Text (based on LOV does not save state) it displays fine.
    If I make the "Code" column display as text based on LOV and make the LOV
    "SELECT display, code FROM huge_table"
    I get the error you see on the page.
    http://apex.oracle.com/pls/otn/f?p=32149:1
    Thanks.

    Thanks for your help Scott.
    So from what I've gathered from my own tests and the discussions you linked me to the LOVs based on SQL queries are being converted into "static LOV" strings before being used.
    As such they are limited to the PL/SQL VARCHAR2 max size of 32767
    Which means given the static reduction of the string 'STATIC:' that we have 32760 characters left.
    Which is where your SUM( LENGTH( display ) + LENGTH( return ) + 2 ) comes in.
    In short, if:
    sum( length( display ) + length( return ) + 2 ) + 7 > 32767
    would evaluate to true then you have a problem. :)
    I'll use this to track down my problems and switch them over to inline queries.
    Thanks.
    Cheers,
    Joe

  • Interactive Report with 2 Links

    I have an interactive report that was built from application wizard when I import an excel spreadsheet.
    The report has an edit link already that is working. The information for that link appears to be on the report attributes tab under the link column section. I need to add another link and found code on the forum which I will put below.
    The problem is the new link column shows, but the button doesn't show, just all the code seen starting with the a href. So - is there a syntax problem that anyone can see? Any input is appreciated. Thanks -- Shelly.
    SELECT CASE WHEN (:A_ROLE = 'MASTER') THEN
    '<a href="'
              || 'f?p=&APP_ID.:3:&SESSION.::&DEBUG.::'
              || 'P3_ID:'
              ||  ID
              || ">'
    || '<img src="#IMAGE_PREFIX#show.gif" border="0">'
    || '</a>'
    ELSE NULL END LINK_COL,
    "ID",
    "PARTNUMBER",
    "DESCRIPTION",
    "SPI",
    "HTS",
    "ECCN",
    "GRI",
    "SOURCEOTHER_INFORMATION",
    "COUNTRY",
    "INITIALS",
    "CHANGE_DATE"
    from "PARTS_CLASSIFICATION"
    where
    NVL(PARTNUMBER,'@') LIKE (:P10_PARTNUMBER || '%') escape '@'
    and NVL(DESCRIPTION,'@') LIKE (:P10_DESCRIPTION || '%') escape '@'
    and NVL(SPI,'@') LIKE (:P10_SPI || '%') escape '@'
    and NVL(HTS,'@') LIKE (:P10_HTS || '%') escape '@'
    and NVL(ECCN,'@') LIKE (:P10_ECCN || '%') escape '@'
    and NVL(GRI,'@') LIKE (:P10_GRI || '%') escape '@'
    and NVL(SOURCEOTHER_INFORMATION,'@') LIKE (:P10_SOURCEOTHER_INFORMATION || '%') escape '@'
    and NVL(COUNTRY,'@') LIKE (:P10_COUNTRY || '%') escape '@'
    and NVL(INITIALS,'@') LIKE (:P10_INITIALS || '%') escape '@'

    Hi Shelly,
    The post doesn't show the code that you have used, so I can not say if there is a syntax error.
    However, you should first check, on Report Attributes, that the LINK column is showing as "Standard Report Column" instead of "Display as Text (escape special characters)"
    Andy

  • Problem to run the Crystal report inside from SAP B1 based on SQL views.

    Hello,
    I have a problem to run my Crystal report inside from SAP B1 which is based on SQL views.And the SQL views are stored in a separate database in SQL server.The error which i am getting is saying the the tablename does not exist.What i need to do in order to sort this problem.
    Great if somebody can help me to sort out this so that i can run my report based on SQL views stored on separate database other than SAP databases inside from SAP B1.
    Edited by: rozenagrawal on Apr 19, 2011 11:51 AM

    Try using a SQL synonym in your company database for the views outside the company database. I don't know if SBO will let you get away with it, but its worth a shot.
    If your company database is MyCompany and you have a view called MyView in Views database, assuming the view belongs to schema dbo, and you want the synonym to belong to dbo schema in your company database, run this:
    Use MyCompany
    go
    create synonym dbo.OutsiderView for
    Views.dbo.MyView
    go
    select * from OutsiderView
    The select statement should return the contents of MyView in the Views database while you are connected to your MyCompany database.
    For more info, see the Books Online for MSSQL on topic synonym.
    You will need to change your CR options to include displaying synonyms along with tables, views, etc. You may also need to grant select to B1 users.
    Edited by: Cindy Lange on Apr 21, 2011 4:00 PM

  • Report "Display Text (Based on LOV)" columns don't like colons - Bug?

    This is a bit hard to explain in text, so I've built a sample app: http://apex.oracle.com/pls/otn/f?p=9608:1
    The app has two pages, which demonstrate two related bugs in the handling of Report "Display as Text (based on LOV)" columns.
    Basically, if the LOV query returns a string that contains colon characters (":") in the display column, the values are matched up correctly, but the colons are stripped from the display.
    If the LOV query returns a string that contains colon characters in the return value column, then the matching fails entirely.
    Removing the colon characters eliminates the problem.
    We actually ran into this in a production environment, after an upgrade from Apex 3.0.0 to 3.2.1. The behavior definitely did not occur in Apex 3.0, but was added at some point between the two versions.

    The colon is actually part of our data (the field in question is a URN namespace).
    And yes, I understand the function of the colon in Apex URL parameter passing. However, I wouldn't expect that sort of parsing to be used against the results returned from an LOV query.
    Also, the LOV is fine in of itself -- a select list based on the LOV displays & returns the expected values. It's only when I use a report column based on an LOV that this behavior creeps in.
    We've found a (fairly painful) workaround -- altering both the report query and the LOV query to to do something like replace(column, ':', '_') -- but that's a manual change to a large number of pages for us.
    This behavior is new to version 3.2.1. It didn't happen in version 3.0.

  • Report column breaking - display text centred in cell

    Hi,
    I am looking for some help achieving the following:
    I have a report which has column breaks on the first three columns. Currently, when the report is displayed, the first column value is displayed in the top row with the rows underneath blank and so on for columns 2 and 3. Then the data for the other columns is displayed as normal.
    What I want to do is have the column values that are used in the break spanning the rows they break over so the text is displayed centred (vertically)
    ie:
    Col1     Col2     Col3           Col4     Col5
                                    dat1     dat2
                                    dat2     dat3
    val1     val2     val3          dat4     dat5
                                    dat6     dat7
                                    dat8     dat9
    val2    xx        xxx         xx        xx
    ________________________________________________ (Hope this works in ascii!!!) - Col1,2,3 etc are the columns - ignore the vals and dats - they're just data placeholders.
    All help much appreciated! :)

    Hi,
    Something like: http://htmldb.oracle.com/pls/otn/f?p=33642:112 ?
    If so, see: Re: How to achieve Page/Form/Report layout?
    Andy

  • Column link - call java script & assign current report column value to item

    Hi,
    How to call java script and assing current report column value to item?
    I have a button column in the report to 'delete' the selected row.
    I want to first show dialog box with message 'Are you sure?'. If yes, process to delete
    will be executed, else no action.
    In order to fire JS, I used Column Link ->Target=URL.
    Problem: The alert is showing but I don't know how to pass selected row's primary
    key value to process (to delete selected row).
    I have a item which can be used to store selected primary key value but don't know how to assign the value
    when button pressed.
    Thanks in advance
    Dip

    Ok. The issue has been resolved by following way.
    PAGE PROCESS: delete_request
    begin
    delete xyz
    where id = :P8_id;
    commit;
    end;BUTTON URL:
    javascript: DelRec(null,'CREATE', 'f?p=&APP_ID.:8:&SESSION.:delete_request:NO::P8_id:#id#');Java Script:
    <script language="JavaScript1.1" type="text/javascript">
    function DelRec(msg, req, url){
    var confDel = msg;
    if(confDel ==null){
    confDel= confirm("Are you sure?");
    }else{
    confDel= confirm(msg);}
    if (confDel== true){
    redirect(url);           }
    </script>

  • Display the second report as modalform and filter with primary key value of first report when you click on first report column link

    Hi All,
    I have two reports.
    1. order report
    2. order detail report
    when you click on the order report column it display the order detail report as a modal form.
    i was done below steps.
    1. In page header i was written the below code
    <link rel="stylesheet" href = "http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/
    redmond/jquery-ui.css" type="text/css" />
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"> </script>
    <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.js"> </script>
    <script type="text/javascript">
    $( function() {
    $('#ModalForm1').dialog(
    autoOpen : false ,
    width :470,
    height: 500,
    resize :false,
    function openForm1()
    $('#ModalForm1').dialog('open');
    function closeForm()
    $('#ModalForm1 input[type="text"]').val('');
    $('#ModalForm1').dialog('close');
    </script>
    2. order report.
    3. order detail report
       select * from order_details where order_id = p_order_id;
    region header
    <div id="ModalForm1" title="Ordered Items" style="display:none">
    <p class="msg"></p>
    footer
    </div>
    4. created the hidden item in order detail report.
    5. in order report column attributes i was given link like below.
    javascript:$s('p_order_id','#order_id#');openForm1();
    when i click on the order report column link it passing the row primary key value to hiddent and open the report as modal form. however it is not filter the report with hidden item. it showing the no data found.
    problem is hidden item value is not submitting. once we submit that value it showing the 2nd report with filter data.
    can any help me to achieve above requirement.
    apex: 4.2
    oracle 11g
    Regards,
    Vijay.

    Vijay,
    Issue 1: Your usage of $s() JavaScript API seems to be wrong. For the first parameter, you need to use the name of the hidden page item and not p_order_id.
    javascript:$s('P1_ORDER_ID','#ORDER_ID#');openForm1();
    Issue 2: Seems like you are not setting the hidden page item's value in session state. Assuming your hidden page item is called P1_ORDER_ID, Under "Region Definition" tab of your "Order Detail Report" under "Source" tab, for page items to submit, enter the name of the hidden page item P1_ORDER_ID.
    Thanks!
    JMcG

  • How to add a "custom" link to a report column

    I have a "Tasks" report that is based on a view. the view is a union of 2 tables: "Project tasks" and "Non-project tasks", each one of them has its own form to enter the data.
    I need to add a link from my report to to either form of the mentioned tables. So, if the task is project related, it should go to the "Projects Task" form, but if the task is no related to projects, the link should point to the second form.
    How can I accomplish that in Apex 4.0 ?
    Thanks

    The view has a column for project name, if it was a non-project task, the column is defaulted to "Non-Project"Add another column to the report query (or to the view if it's a Wizard report), based on that column:
    case project_name
      when 'Non-Project' then '201' /* Page ID of non-project task form */
      else '202' /* Page ID of project task form */
    end form_page
    ...Then add a link to the required report column as described above by Alan, setting the target Page attribute to <tt>#FORM_PAGE#</tt>, the Name attribute of the task ID parameter to <tt>P#FORM_PAGE#_TASK_ID</tt> (the form pages will need to take task ID parameters following this naming convention), and the Value attribute to the task ID column from the view.

  • Call Javascript function to pass a id  from APEX report column link

    Hi,
    Can anyone help me, in a report column link i'm calling a function to pass an id and i want to onclick change a icon on that column based on the value on the column status of this table.
    Is this possible?

    Hi Ron,
    I am doing exaclty what you have suggested me but no luck. I started changing the DEMO_CUSTOMERS application to my requirements.The report is working fine and on the report I have created a page attribute to the Hyper linked column and linked that to the page 2 and assign that attribute with #JOBNUM#.
    I am able to pass that value on to form when I click on the JOBNUM. But the problem is I am not able to pass that value into the SQL query so that my query pulls 20+ columns on to the Form ( which is second page ).
    Small clarification... On the form region it is said FORM NAME and type is HTML is that is the way the APEX was designed or does it need to say region type as FORM.
    Thanks for your help in advance.
    Cheers,
    Krishna.

  • Urgent - Report Column based on LOV - Value not found in LOV

    Hi All,
    Recently, we have upgraded to HTMLDB 2.0 from HTMLDB 1.5.
    I have a SQL report. One of the columns is based upon LOV - Display as Text (Based on LOV, does not save state).
    For the "Ids" of the report, it should display the corresponding "Names" from the LOV.
    But, for the cases, where no record exist in LOV for some Id, then it is directly showing the Id instead of "-" (which i have specified in Display Null Text) in the report column attributes.
    Before upgrade, it was working fine.
    Any idea where is the issue.
    Please help.
    Thanks in advance,
    Monika

    Hi,
    Can anybody help me in sorting out this issue please.
    For your reference, i have made a test case on
    http://apex.oracle.com/pls/otn/f?p=20451:4:3519837362944582:::::
    Here, there are 2 tables
    1. MY_EMP_COUNTRY(emoid, empname, cntry_id)
    2. MY_COUNTRY_LOOKUP(id, name,active)
    LOV is created on table 2
    select name d, id r
    from my_country_lookup
    where active = 'Y'
    And, on the page a SQL report is created
    select empname, cntry_id
    from my_emp_country
    where, cntry_id is based upon the LOV.
    Since, in lookup table, cntry_id = 4 is set inactive, it is not picked up by the LOV and hence on the report instead of showing the NULL text it is showing the cntry_id (4).
    The attributes of report column cntry id -
    Named LOV = CNTRY_LOV
    Display Null = YES
    NULL text = -
    Display Extra Value = YES
    Am I missing anything.
    thanks,
    Monika

  • Add automatic e-mail link to report column

    I have a report displaying on one of my pages. One of the columns contains user e-mail addresses. Is there a way to have the actual text of the e-mail address serve as a direct link to Outlook? Ie. when the text of the e-mail address is clicked, Outlook will automatically open with the e-mail address selected in the To: line?
    Thank you in advance for any assistance.

    Hello Lauren,
    You can define the proper column in your report as a link. I named this column "EMAIL". In the column attribute page, In the column link section, you can use the following parameters - http://i4.tinypic.com/104hu80.png
    The "mailto" will open the default mail client at the desktop – if it's Outlook, it will open Outlook.
    Regards,
    Arie.

Maybe you are looking for

  • How to create an image of an audio CD

    Hi everyone, I just recorded my new DJ set, and I would like to share it over my website. But this time I would like to share it, not only in MP3 format, but also as an actual CD, that people could download and burn as if it were an original. I have

  • Embed an images in a textfield

    Hi has anybody tried embedding an image in a textfield using the <img> tag? I've found the image jumps on to the next line or in some way doesnt work the way i intend it. Is there a trick to getting the images to line/flow up with the TEXT correctly?

  • Making a master out of a slide

    I have created a slide and now would like to have it available as a master slide. Is there a way to do this. It was tedious to do to set up all the builds and action and if I can avoid repeating the work, I would love to. Thanks. Carole

  • Safari dont want to open only one (my own) website, the post connected to this site cant download any emails

    Sorry for my english. I have my own website (can tell you the name, if you ask). In December after I have installed 5.0.1 my website and the post doesnt work via 3g, gprs. With wi-fi everething is ok. In opera via 3g, gprs, wi-fi everething is ok. th

  • New Maps are horrible

    I bought a data plan for my iPad so I could specifically use maps.  The new maps app has incorrect roads, places, and poor traffic info. for my area (Norfolk, Virginia).  They are saying that VCU (Virginia Commonwealth University) is in downtown Norf