Dynamic PL/SQL Report with html embedded in result

Hi,
I am trying to embed an html image tag element in an query result. I have followed the how to example (MS SQL down; Oracle up) successfully. However I now require the query to be dynamic based upon sone filtering criteria simalar to the how to example:
So the query code looks something like this:
<p>
declare
<p>
q varchar2(1000);
<p>
begin
<p>
q:= ' select ';
<p>
q:= q || ' decode(status, ';
<p>
q:= q || ' 1, ''&lt;img src="up.gif"&gt;'', ';
<p>
q:= q || ' 0,''&lt;img src="down.gif"&gt;'') status, ';
<p>
q:= q || ' item_id item ';
<p>
q:= q || ' from item_table ';
<p>
return q;
<p>
end;
(note this is a simplified example)
The problem is that the image does not display and I think it is because of the double quotes - " - embedded within the query string for the html image element.
Can anyone help, point out my error or suggest an more appropriate implementation.
Thank for any help!
sinclair

Sorry for the previous post. Here is what I did based on your example:
http://htmldb.oracle.com/pls/otn/f?p=31517:1
and it works.
The query is like:
DECLARE
q VARCHAR2 (1000);
BEGIN
q := q || 'SELECT deptno, DECODE(deptno, ';
q := q || '10, ''&lt;img src=" #IMAGE_PREFIX#bullet1.gif" >'',';
q := q || '20, ''&lt;img src=" #IMAGE_PREFIX#bullet2.gif" >'',';
q := q || '30, ''&lt;img src=" #IMAGE_PREFIX#bullet3.gif" >'',';
q := q || '40, ''&lt;img src=" #IMAGE_PREFIX#bullet4.gif" >'') ';
q := q || 'image, dname FROM DEPT ';
RETURN q;
END;
In your query you wrapped the image file name in double quotes, which wasn't necessary.
Denes Kubicek

Similar Messages

  • Applying a Template to a Dynamic PL/SQL Report

    I have an application in which there are several reports, all based on the wizard and using standard templates.
    One of my reports, however is a Dynamic PL/SQL Report, using htp.print statements to create the output.
    I'm not quite sure, how I can specify that I want to use the same template as the rest of my reports, so as to maintain the look and feel of the whole application.
    Can someone tell me how this is done, or where I can read about it?
    Thank you.

    Sergio,
    I have a table with two columns I want to display. The columns aren't wide but there are 15 or 20 rows. What I would like is that after 10 rows the report starts another set of colums beside the first ones. The standard report continues on down so you have to scroll down to see the bottom. I'm not sure if my explanation is clear so instead of:
    1 info1
    2 info2
    3 info3
    4 info4
    5 info5
    6 info6
    I want:
    1 info1 4 info4
    2 info2 5 info5
    3 info3 6 info6
    Not being too picky, it could also be:
    1 info1 2 info2
    3 info3 4 info4
    5 info5 6 info6
    I don't see a way of doing this with standard reporting so a PL/SQL report seems to be the way to go (which works fine except for the formatting). Sorry if I've just missed it in the options. I'd prefer to do it using standard HTMLDB
    Thanks.
    Paul

  • SQL Report with Scroll - javascript

    This is an example of Apex SQL Report with Scroll - made with javascript: http://tryapexnow.com/apex/f?p=12090:9
    Waiting for comments here.

    Yes, because of the page generated by APEX, if you use the Report Template APEX 4.0 Standard, the div created for the report table has the ID "with_scroll" but there is another div which actually contains the table, and it's ID is "report_with_scroll", they just add a "report_" in front of it.
    I find the table by searching through the childs of that div: var table = document.getElementById(myRegion).rows[1].cells[0].firstChild;
    You can use the first one, with the ID "with_scroll", but this code line will be longer.
    Also to addapt the script for other report templates, you just need to see the code generated by every template, and correct this line, to get the real table containing your report.

  • SQL report with delete capability

    I want to create a SQL report with the capability of delete rows (show checkboxes next to each row). Is this possible?

    You can create a page type of Tabular Form, remove all buttons but delete, change all the edit boxes to display as text (saves state) and use that.

  • SQL Report with 1 updatable column - help urgent

    Hi,
    I have a SQL report. I am using collection to store value of selected record by link column.
    I have a updatable text item (NULL) in the column. I am able to store that value in the collection.
    Any clue?
    Code
    1. Creating a collection in parent page:
    apex_collection.create_or_truncate_collection
    (p_collection_name => 'ORDER');
    2. Query to populate item rows with option to key 'QTY' before pressing 'Add to Order' link.
    select
    itemcode,
    description,
    NULL AS qty,
    'Add to Order' add_to_order
    from itemtab
    3. Made 'QTY' to Text item -- to allow users to key value
    4. Created 'hidden & protected' items P1_ITEMCODE, P1_QTY
    5. Set values of itemcode, qty in add_to_order link
    6. Created a process to add values into collection:
    for x in (select * from itemtab where itemcode = :P1_ITEMCODE)
    loop
    apex_collection.add_member(p_collection_name => 'ORDER',
    p_c001 => x.ITEMCODE,
    p_c002 => x.DESCRIPTION,
    p_c003 => :P1_QTY
    end loop;
    7. Display value of itemcode, description, qty in report region
    select c001, c002, c003
    from apex_collections
    where collection_name = 'ORDER'
    Probem: The value of qty is not being stored in the collection and not appearing in the #7 report. itemcode and description values are fine.
    Thanks,
    Dip

    Dip,
    I'm guessing here as I can't see your application, I think your missing the page process to collect the data from your QTY field.
    I created a quick demo of what i think your trying to achieve on apex.oracle.com
    http://apex.oracle.com/pls/apex/f?p=19923:2
    I added this to the html expression on the report Field add to:
    <input type="button" onclick="doSubmit(#RANDOM_ID#)" value="Add To" />
    Then the page process to collect and set the page item:
    DECLARE
    l_qty number;
    BEGIN
    FOR i in 1..APEX_APPLICATION.G_F03.COUNT LOOP
    l_qty := nvl(APEX_APPLICATION.G_F03(i),0);
    IF l_qty > 0
    THEN
    :P2_QTY := l_qty;
    :P2_RANDOM_ID := :REQUEST;
    EXIT;
    END IF;
    END LOOP;
    END;
    Let me know if this helps
    Mark
    Don't forget to mark reply as helpful or correct as this may help others reading this thread in the future!
    Edited by: cptbutcher on Mar 25, 2010 10:40 PM

  • Pl-sql report with parameter

    Hi
    I have created report with region source as pl-sql. In pl-sql block, calling package where i am passing query. In query's where clause i want to pass paramter value which user had selected.
    There are two regions on page. On upper part, there is select list, on lower part there is report with pl-sql region but value of select list is not found in query. I am trying to access with bind variable, select list of item :SL_TEXT. But it is not showing any value in it.
    How to use select list value in query of report? Or let me know how to use parameter in pl-sql report which is selected in other region?
    Thanks in advance

    I am attempting to define the variable as a date variable through Oracle BI and yes it does use a colon to signal variable substitution.
    So thank you the first way you stated should work.
    The only problem I'm running into now I believe steems from the date format that column that I am trying to filter on. It is in what appears to be the worst format possible.
    Is it common for dates to be stored in a DD-MON-YY format? (e.g. 01-JAN-08) I thought we as a community had moved past that post Y2K scare. lol.
    When I set up the bind variable in BI it allows me to define the date format, much similar to the TO_DATE function but then it says (must be java date format). So I'm thinking that maybe DD-MON-YY is not a java date format.
    In that case is there a way to cast or convert my date format in the sql so that it is a supported java date format?
    Or should I just give up and pass it as a varchar2?

  • Problem of POP LOV  in a  SQL Report  with pagination

    I am using a pop up lov (along with some other fields), HTMLDB_ITEM.POPUP_FROM_LOV(5, null, 'EMPLOYEE_LIST', '20', '50')), in a sql report. This is a report with pagination. Whenever I select any value from pop up lov on first page of the report it gets populated properly in the corresponding text field. But from second page onwards it doesn’t populate any value.
    For example, my report fetches a total of 50 rows, of which I am displaying 15 at a time. The popup lov comes with a text field for each row. Whenever I do select from popup lov for 1-15 rows which come on page 1, the values come up in the text field properly, but for rows 16-30 on second page, 31-45 on third 46-50 on fourth the values do not get populated. When I changed the pagination settings to display 40 rows..the values were still coming properly on page 1(1-40 rows) and not on the next page. Any clues… how to resolve this problem?

    good find. this is a bug that has already been identified and will be corrected in the upcoming patch release for htmldb. a good work-around for now is to use the equivalent declarative options in the tool. so rather than coding your query like...
    select ename , HTMLDB_ITEM.POPUP_FROM_LOV(2, null, 'DEPARTMENT', '20', '50') as "department" from emp
    ...just code it like this...
    select ename , null as "department" from emp
    ...and then use the column attributes screen for your "department" column to indicate that you'd like that col to be rendered as a "Popup LOV (named LOV)" using your DEPARTMENT list of values.
    hope this helps,
    raj

  • Generate PDF report with HTML data

    Hi All,
    I am using BI Publisher to generate my reports but I stumbled on a big problem...
    I have a table with a column TASK_DESCRIPTION. This column is a CLOB containing a simple HTML coded page. When a user works with the application he sees a nicely formatted page but when I generate a report I get all the html tags in it (< html > < h4 > ...etc...)
    Is it possible to somehow convert the source data from the table (which is html code) into readable formatted text when generating the report?
    ANY ideas are very welcome!
    Regards,
    Pawel.

    Yes you can do this with an XSL template converting HTML to Formatting objects.
    There are a few catches however. First, you must be sure your markup-fragment is valid XHTML, that is all tags must be closed. Luckily the builtin standard HTML-editor does this.
    I wasn't able to call BI-publisher from within Apex without the XHTML-fragment being escaped, but i managed to create a query on a table containing the fragment within BI-publisher itself. This leaves the fragment intact, producing a valid XML-document.
    This is very important because the XSL attached to the RTF-template must be able to match and convert the XHTML-tags to FO.
    Basic setup :
    Create a datasource (query) within BIP.
    Create the RTF-template and add an extra field (at the top) containing : <?import:file:///C:\xhtml-to-xslfo.xsl?> or whatever location the XSL-file resides.
    Now, layout your report using the wizard and change the field containing the XHTML-fragment into <xsl:apply-templates select="TASK_DESRIPTION"/>
    There are a few XSL-templates out there converting XHTML to FO. One I found particularly useful : http://www.ibm.com/developerworks/library/x-xslfo2app/xhtml-to-xslfo.xsl
    You might want to change the .xsl so it matches tags case insensitive (eg. <xsl:template match="a|A"> )
    Another caveat is the html-entities for special characters. When the XML from the datasource is parsed by BIP it doesn't recognise entities like &Agrave ; .
    This can be solved by creating a pl/sql function converting these characters to numeric entities like &#192 ;. and use this function in the select statement of your datasource. see http://www.w3schools.com/tags/ref_entities.asp
    Now you can call the report from Apex using an URL to the report definiton (see BIP docs for URL syntax and parameter passing)
    Not a 'really' integrated solution but I had some nice results.
    It would be nice though if we could specify a .dtd containing the references for HTML-entities and a sort of flag wheter the report column should be escaped or not, from within Apex. This would allow us to embed XML-fragments within the XML that Apex produces, resulting in a valid XML doc. Using XSL, you can then match the tags of the XML-fragment and convert it to FO.
    Good luck !
    Maarten

  • Reports with HTML links to "sub-reports"

    I have a main sequence that runs several sequences of tests.  I
    would like to have these tests create separate reports and then link
    them from my main sequence's report.  I have selected HTML
    reporting style.  I have figured out how to link by looking at Teststand\Examples\ModifyingReports\HTMLDiagnosticLinks. 
    The only thing left is figuring out how to create the "sub-reports"
    instead of including the information in the main report.
    Any suggestions?
    Thanks,
    Bob Young
    Bob Young - Test Engineer - Lapsed Certified LabVIEW Developer
    DISTek Integration, Inc. - NI Alliance Member
    mailto:[email protected]

    Ray,
    I would like to have the sub-reports be the same format as the main report but it is not important if it has a header like the main report has.  I think that it needs to just make a report that will print on 50 pages into something easily readable.  I have already toyed with the idea of a database, but I would still have to create a report of some sort, so if I can modify TestStand's report sequence to do it, that would be even better.
    So basically I am dynamically calling a series of selectable tests.  If each of the called tests had their own report liked in to the main test where it was called, that would be great. 
    So, I'm looking for something like this:
    Main Report: 
    UUT Report
    Station ID:
    BOBY-L
    Serial Number:
    NONE
    Date:
    Monday, December 12, 2005
    Time:
    4:16:19 PM
    Operator:
    administrator
    Number of Results:
    37
    UUT Result:
    Failed
    Failure Chain:
    Step
    Sequence
    Sequence File
    Numeric Limit Test: Receive 7 bytes
    MainSequence
    Read Test.seq
    SequenceCall
    MainSequence
    testing.seq
    Begin Sequence: MainSequence
    (C:\VSS\Test Driver Code\Tests\Initializing Driver Test\Initializing Driver Test.seq)
    SequenceCall
    Status:
    Passed
    **********************LINK TO TEST****************
    End Sequence: MainSequence
    *****************SUB-REPORT LINKED IN*****************
    Begin Sequence: MainSequence
    (C:\VSS\Test Driver Code\Tests\__TestStand - Common Components\common sequences\Read.seq)
    Read 20 bytes
    Status:
    Passed
    Read the following bytes from Address 0000 of the FLASH:
    46 00 C5 07 00 00 70 00 C3 03 00 00 9A 00 8D 04 00 00 E8 00
    End Sequence: MainSequence
    Bob Young - Test Engineer - Lapsed Certified LabVIEW Developer
    DISTek Integration, Inc. - NI Alliance Member
    mailto:[email protected]

  • Discoverer Custom SQL Report with Group By,Having

    Hi all,
    I'm working with Discoverer 4.1.41.05 and retrieve data from Oracle HRMS.
    I want to create a report based on a custom SQL Folder in Discoverer Administration to solve the following scenario:
    SELECT EMPLOYEE_NUMBER FROM PER_ALL_PEOPLE_F
    MINUS
    SELECT EMPLOYEE_NUMBER FROM PER_ALL_PEOPLE_F,PER_EVENTS, PER_BOOKINGS
    GROUP BY EMPLOYEE_NUMBER
    HAVING SUM(PER_EVENTS.ATTRIBUTE1) >= 10)
    The problem is when I run the sql from SQL*Plus is working fine producing the correct result.
    When I create the Custom Folder and create a Discoverer report based on it I retrieve all employees since the second select statement retrieve no rows!
    Does anyone has any idea how I can solve this problem or if there is another way to create this scenario?
    Any feedback is much appreciated.
    Thanking you in advance.
    Elena

    Hi Elena,
    I think you are missing some joins, you could try something like:
    SELECT EMPLOYEE_NUMBER FROM PER_ALL_PEOPLE_F p
    WHERE NOT EXISTS
    (SELECT NULL
    FROM PER_EVENTS e, PER_BOOKINGS b
    WHERE b.person_id = p.person_id
    AND e.event_id = b.event_id
    GROUP BY b.person_id
    HAVING SUM(e.ATTRIBUTE1) >= 10)
    Rod West

  • SQL Report with Total Salary

    I have a select statement like this:
    Select first_name, last_name, salary From Employee
    I am getting report properly with this query. But my question is : How can get total salary at the bottom of report?
    If I crate another region with a new SQL, I could do that but I want in single SQL or PL/SQL.
    Any help would be appreciated.
    Thanks,
    Mushtak

    Hi, you can do something like this:
    Select first_name, last_name, salary From Employee
    Union
    Select null first_name, 'Total salary' last_name, Sum(salary) From Employee
    order by first_name
    Hope this helps
    George

  • Interactive Report with html tags --- Data saved in Excel with html tags

    Hello,
    I am using APEX 4.0. I have an interactive report that displays some of the columns bold and / or colors using html tags. As an example,
    SELECT
    '''<font color="green"><b>'' || SERIAL_NUMBER || ''</b></font>'' SERIAL_NUMBER,'||chr(10)||
    'PRODUCT_NAME,'||chr(10)||
    '''<font color="teal"><b>'' || PRODUCT_DESC || ''</b></font>'' DESC,'||chr(10)||
    'QUANTITY,'||chr(10)||
    FROM
    <Table name>
    At runtime, the Interactive Report displays the fonts, colors correctly; however, when I save the data of the Interactive Report in an Excel format, it saves the Html tags along in the EXCEL spreadsheet. For example, the column serial number from the above SELECT statement is extracted in an Excel column as ---
    <font color="green"><b>123456789</b></font>
    Is there another way to render the column data so that extracted data will not display the HTML tags or is removing the html font color tags from the SELECT statement the only option?
    Thanks in advance.
    Ed

    Hello,
    I have a feeling all your problems are related take a look at this thread. I found it in 10 seconds of searching the forum.
    strange tags
    It's always best to do a quick search first most likely you are not the first person to have this problem.
    Carl

  • PLSQL-generated SQL report with variable number of columns

    I created an app to track college football bowl picks:
    http://apex.oracle.com/pls/otn/f?p=21723
    The main report region includes columns for the various games as well as a column for each participant. In order not to hard code the number of participants, I used PLSQL to generate the SQL so that new columns could be added on the fly.
    However, whenever I add a new user I get this result -
    report error:
    ORA-01403: no data found
    If I copy and paste the PLSQL into a new report region and then delete the old one, however, all is well.
    Is there something I can do to overcome this?
    Thanks.
    Bill

    Roberto
    <br><br>
    Here are the tables:
    <br><br>
    BOWL_GAMES<br>
    ID     NUMBER<br>
    NAME     VARCHAR2(30)<br>
    FAV     VARCHAR2(20)<br>
    DOG     VARCHAR2(20)<br>
    BDATE     DATE<br>
    LINE     NUMBER(3,1)<br>
    FAV_SCORE     NUMBER(4,0)<br>
    DOG_SCORE     NUMBER(4,0)<br>
    <br>
    BOWL_USERS<br>
    ID     NUMBER<br>
    USERNAME     VARCHAR2(20)<br>
    PW     VARCHAR2(20)<br>
    NAME     VARCHAR2(20)<br>
    EMAIL     VARCHAR2(50)<br>
    <br>
    BOWL_PICKS<br>
    ID     NUMBER(5,0)<br>
    USERID     NUMBER(10,0)<br>
    GAMEID     NUMBER(10,0)<br>
    PICK     NUMBER(1,0)<br>
    <br>
    <br>
    Below is my PLSQL. Feel free to try out the app. Thanks.
    <br><br>
    Bill<br><br>
    declare<br>
    p_sql varchar2(32767);<br>
    cursor c1 is select * from bowl_users order by id;<br>
    begin<br>
    p_sql := q'! select to_char(b.bdate, 'Mon FMdd') "Date", b.name, '< a href="javascript$pickEm(''' || b.fav || ''')">' || b.fav || '</ a> -' || b.line || ' < a href="javascript$pickEm(''' || b.dog || ''')">' || b.dog || '</ a>' "Line" !';<br>
    for a1 in c1 loop<br>
    p_sql := p_sql || q'! , bowl_strike(b.id, !' || a1.id || q'! , 0) || (select decode(p.pick, 0, substr(b.dog,1,4), 1, substr(b.fav,1,4), 'No pick') from bowl_picks p where p.userid = !' || a1.id || q'! and p.gameid = b.id) || bowl_strike(b.id, !' || a1.id || q'! , 1) "!' || upper(a1.name) || q'!" !';<br>
    end loop;<br>
    p_sql := p_sql || q'! , bowl_score(b.id) "SCORE" from bowl_games b order by b.bdate !';<br>
    return replace(p_sql,'$',':');<br>
    end;
    <br><br>
    Message was edited by:
    [email protected]

  • Old posts with HTML embedded - will they be fixed?

    Are old posts like this that are full of embedded HTML eventually going to be normalized?
    There are quite a few of them floating around--maybe people posting in from the news servers in the past?

    I just asked John C. about this in regards to all the links in the Photoshop Lounge Resource Repository.
    JOHN! Please check your forum system Private Messages! (Or at least just let me know that you have, so I don't keep pestering you)
    Thanks.

  • SQL query with parameter returns empty result set, please help !!!

    Hi there,
    When I use the following query :
    <sql:query var="beroepsthemas" >
    select *
    from beroepsthemas
    where beroepsthemaid = ?
    <sql:param value="12"/>
    </sql:query>
    When I want to browse the result set with :
    <c:forEach items="${beroepsthemas.rows}" var="rij">
    it shows no records. But it must return at least one.
    All my jsp pages with sql queries and parameters have the same problem.
    This is all on my test environment. I'm using Ubuntu 5.10, Netbeans5.0, JDK 1.5_06, application runs in Bundeled Tomcat 5.5.9, MySQL 4.1.12, mysql-connector3.1.6
    When the same code is run on the live environment, it works just fine.
    The difference is :
    Mysql 4.1.10a, tomcat5.5.9, mysql-connector3.1.6
    What can there be wrong !!

    When the same code is run on the live environment, it
    works just fine.
    The difference is :
    Mysql 4.1.10a, tomcat5.5.9, mysql-connector3.1.6
    I didn't catch this. I think you may need to update the database driver.

Maybe you are looking for

  • Certain songs won't play on devices

    I have an iphone 5 and an older ipod colour 30gb. Recently the iphone wouldn't get new songs added to it during syncing with itunes. I removed all music then readded it. It now has all songs displayed on it, but will only play some. The ones which do

  • How do I save an edited image back to my iPhoto gallery?

    How do I save an edited image from Elements back into my iPhoto gallery?

  • Is my Photoshop CS6 legal?

    Is my Photoshop CS6 legal?  Under "Help"; "Product Registration", "Deactivate" and "Updates" are grayed out. I have a legal CD & serial# (& Adobe receipt/packing list).  When someone else reinstalled Windows7 on 12-04-12, CS6 was reinstalled.  Since

  • New palm and getting the info from my old palm on the new one.

    Hi there.  I had to have a new centro ordered because my first cento's keys stopped working.  The sprint store recommended me coming home and backing up all my data on my first centro while I was waiting for the new centro to arrive.  All of my data

  • INVENTORY REPORTS

    Hi, I want a report to view obsolete inventory, slow moving  inventory and inventory turns.