Download Link as a Column of Report

Hi All,
I really tried from my side to somehow implement this requirement but couldn't find a way.
Requirement: A report with two main columns - One has unique value and the other has a download link. This download link need to be used to fetch a set of data from the database table using the other column's (unique) value. Then, user should get a popup on his screen to download the fetched data in csv format.
Please give some guidance or pointers to resolve this issue.
Regards,
Mangal

Hi Mangal
I've done this before actually. You can create a dummy page with a process (on load before header) as a PL/SQL anonymous block. I got code from Denes Kubicek's site which has details of how to generate CSV output using the htp.prn funtion. Then I created the 'download' link in a report column to go to that page passing a value into a hidden field with the unique id of the row.
The code on the new page looks something like this but I would refer to Denes' work for full information (most of this is copied from him).
BEGIN
-- Set the MIME type
owa_util.mime_header( 'application/octet', FALSE );
-- Set the name of the file
htp.p('Content-Disposition: attachment; filename="download.csv"');
-- Close the HTTP Header
owa_util.http_header_close;
htp.prn('Header Name,');
FOR x IN   (SELECT field1, field2, field3...
              FROM my_table
              WHERE my_id = :PX_HIDDEN_ID)
LOOP
-- Print out a portion of a row,
-- separated by commas and ended by a CR
htp.prn(chr(34)||x.field1   || chr(34) ||','|| chr(34) || x.field2   || chr(34) ||',' ||
         chr(34)||x.field3..... || chr(34) ||chr(13));
END LOOP;
-- Send an error code so that the
-- rest of the HTML does not render
htmldb_application.g_unrecoverable_error := true;
END;Hope this helps.
Cheers
Ben

Similar Messages

  • Sharepoint 2013 - How to add "download link" to a column

    Hi there.
    We have download library with video files. We would like to add a column with a hyperlink of files in other words: DOWNLOAD LINKS.
    What would be the easiest way to achieve that?
    with best regards,
    bostjanc

    Hi Bostjan,
    you can create a workflow that, on item create, sets your download link column with this value:
    http://<your site collection url>/_layouts/download.aspx?SourceUrl=<your file url>
    hope this helps.
    Fabio

  • Link for BLOB column in report?

    Hi all,
    I wonder if it is possible to declare a blob colum (displayed image) as a link.
    What I try to do is to display images in a report and give the user the option to just click on the image an get a popup window where he/she can change or delete the image. As far as I have seen this is not possible with the standard link declaration. You can fill in the link parameters but this has no effect on the generated page.
    Thanks
    Andy

    I eventually found another post: APEX_UTIL.GET_BLOB was not found on this server
    In this post there is the suggestion of putting "dbms_lob.getlength("var")" after the date field in your select. So I changed my query to have it at the end, and now my format mask (DOWNLOAD:table_name:ATTACHED_FILE:FILE_ID::FILE_MIME_TYPE:FILE_NAME:::attachment:Download) works like a charm, in a classic report.

  • Interactive Report Download Link Question

    I have an interactive report where I have outer joined to a table that contain blobs that I want the user to be able to click a link to download. I have a custom procedure that works with the download link. However I can't figure out how to get the download link to only appear for the records that actually have a file (since it is outer joined, only some of the records have a blob file associated with them).
    Click this link to see a screenshot of the report example.
    The existing column with the download link was created as a column link, where I specify the url (to my custom download proc). The problem as you can see is that it puts the download link in that column for every row, whether there really is a file to download or not. I'd rather only have a download link where there is a file to download for that record (see the My File column).
    Thanks in advance for any help on this.

    HOT TIP
    If you are passing parameters into your download procedure in the URL then the users will be able to hack the URL and download information they shouldn't be able to. More worrying, if you have granted execute to public (which I think you have to) on the Procedure then information can be downloaded without the user being authenticated.
    The solution is to have a page in the application with an On Load - Before Header process that calls the procedure, with some hidden items as parameters for the procedure. You can then evoke the procedure by branching to the page in the usual way and setting the page items in the URL. This will also allow you to add the additional Apex security features such as Session State Protection (Page requires a Checksum). Remember to revoke the execute privileges from Public.
    Change the report link to:
    SELECT some_columns,
      NVL2(my_file,'Download',null) link
    FROM your_table Then use the 'column link' region to create the link in the usual way and set the Link Text to #LINK#. If you have set the target page to require a Checksum this will then be added without having to code it into your sql.
    I hope that makes some sense?
    Shunt

  • How to display download link with get_blob or get_blob_file_src ?

    Hello there,
    I am struggling to display a download link in a SQL query report.
    Based on the requirement, I have to create a sql query report that the source contains a series of union select query.
    Example here
    WITH current_engagement AS (
    SELECT defendant_id, engagement_id, pn, ethnicity, date_joined_aodt_court, case_manager_name
    , participation_conditions, discharge_conditions
    FROM engagement
    WHERE defendant_id = :PXX_DEF
    AND date_joined IS NOT NULL
    AND ( date_terminated IS NULL OR to_date(date_joined,'DD/MM/YYYY') > to_date(sysdate,'DD/MM/YYYY'))
    AND active = 1 AND ROWNUM = 1
    ORDER BY defendant_id DESC
    SELECT def.first_name, def.middle_name, def.surname, to_char(def.pn) AS "PN", to_char(def.nhi_number) AS "NHI"
    ,ce.ethnicity, to_char(ce.date_joined) as "DATE_JOINED ", ce.case_manager_name, ce.participation_conditions, ce.discharge_conditions
    FROM defendant def INNER JOIN current_engagement ce
    ON def.def_id = ce.defendant_id
    UNION ALL
    select ' <b>2. Phase Number</b>' , '<b>Date Started</b>' , '<b>Date Finised</b>' , '<b>Notes</b>' , null
    ,null , null , null , null , null
    from dual
    UNION ALL
    SELECT TO_CHAR(NVL(ph.phase_number,'No Phase Found')), TO_CHAR(ph.date_started, 'DD/MM/YYYY'), TO_CHAR(ph.date_finished, 'DD/MM/YYYY'), ph.notes, null
    , null , null , null , null , null
    FROM phase_membership ph INNER JOIN current_engagement ce
    ON ph.mpm_eng_id = ce.engagement_id
    WHERE to_date(ph.date_started,'DD/MM/YYYY') <= TO_DATE(sysdate,'DD/MM/YYYY')
    AND ( ph.date_finished IS NULL
    OR TO_DATE(ph.date_finished, 'DD/MM/YYYY') >= TO_DATE(sysdate,'DD/MM/YYYY') )
    AND ph.active = 1
    UNION ALL
    --more selects
    -- then the last select is to list all related documents with download links
    select '<b>6. Document Date</b>' , '<b>Document Type</b>' , '<b>Description</b>' , '<b>Download</b>'
    , null ,null , null , null , null , null
    from dual
    UNION ALL
    SELECT TO_CHAR(doc.date_received), doc.document_type, doc.comments, TO_CHAR(dbms_lob.getlength(doc.UPLOADED_FILE))
    , null ,null , null , null , null , null
    FROM document doc INNER JOIN current_engagement ce
    ON doc.d_eng_id = ce.engagement_id
    WHERE doc.active = 1
    This report is generated fine.
    But the requirement also ask to display a download link. And because it is union selects, all following selects must be the same as the first select column data types.
    In this case, it has to be CHAR. Otherwise, it will generate error as below
    ORA-01790: expression must have same datatype as corresponding expression
    So I follow the GET_BLOB_FILE_SRC Function step from
    http://docs.oracle.com/cd/E14373_01/apirefs.32/e13369/apex_util.htm#AEAPI129
    I turn my last select into
    SELECT TO_CHAR(doc.date_received), doc.document_type, doc.comments,
    CASE WHEN NVL(dbms_lob.getlength(doc.UPLOADED_FILE),0) = 0
    THEN NULL
    ELSE
    'Download'
    END
    , null ,null , null , null , null , null
    FROM document doc INNER JOIN current_engagement ce
    ON doc.d_eng_id = ce.engagement_id
    WHERE doc.active = 1
    Which the result inside the hreg is
    http://app_address_here/f?p=208:48:1303335952329758:::::
    while if I use Interactive report the link is
    http://app_address_here/apex_util.get_blob?s=1303335952329758&a=208&c=66645817090447568&p=48&k1=12&k2=&ck=A18D20D407435BD649EA3399EC27BC00&rt=CR
    and it works well.
    I do a research and know that get_blob_file_source link to the source of the column / field name located in the first parameter.
    So I had put the UPLOADED_FILE column, DOCUMENT table in the source of the column PN.
    But it still does not show anything that close to the correct one that is generated by interactive report.
    If anyone has any ideas, please help. If I need to manually write using get_blob , please give me an example.
    I urgently need to do this report.
    The version of APEX we use is Application Express 4.0.2.00.07
    And I cannot ask for an upgrade to 4.2 till the end of next year.
    Please help.
    Thanks a lot in advance.
    Ann.

    Hi Ann,
    Here you can see and download the example :
    http://apex.oracle.com/pls/apex/f?p=63066:1
    Please let me know if you need access the work space.
    Hint, Please read the FAQ section. had you put your thread in a better format, you would have gotten a quicker response :)
    Regards,
    Fateh

  • Problem with download link for a BLOB Column in a "Classic report"

    I am having a problem where I cannot make a download link for a blob column function in a "classic" (non-interactive) report. I went through the tutorial on this topic and it was great help it working out the minor bugs, but I get a 404 error (apex_util.get_BLOB not found). For testing purposes I went ahead and created a an identical report on the same page that is an "Interactive report" and it works like a charm. Same query, same BLOB formatting Mask, pulling data from the same table. So, it really doesn't seem like an issue with the grants, since both reports should be executing as the same user.
    I know it sounds like the obvious answer is to just go with the interactive report and my problem is solved, but the rest of this site uses classic reports, and I don't need the sort features of an interactive report, and the slightly different style of the the report really stands out even if I turn off all the bells and whistles. I don't want to change the css to make them look identical, I just want a regular report to work.

    I eventually found another post: APEX_UTIL.GET_BLOB was not found on this server
    In this post there is the suggestion of putting "dbms_lob.getlength("var")" after the date field in your select. So I changed my query to have it at the end, and now my format mask (DOWNLOAD:table_name:ATTACHED_FILE:FILE_ID::FILE_MIME_TYPE:FILE_NAME:::attachment:Download) works like a charm, in a classic report.

  • Referencing report columns in the BLOB download link format mask

    Hi there,
    In a basic report (Apex 4) I have a link to download a BLOB stored in the table. However to save space, instead of using 2 columns, one for the file name and one for the download link, I want to use only one column where the file name is the download link itself.
    To do this, I tried using this download link format mask (ATTACH_FILENAME is the report column that contains the file name):
    DOWNLOAD:ATTACHMENTS:ATTACH_BLOB:ATTACHMENT_ID::ATTACH_MIME_TYPE:ATTACH_FILENAME:::attachment:#ATTACH_FILENAME#
    However it shows #ATTACH_FILENAME# in all rows instead of the actual file name!
    I know that using substitution strings (&) works, so is there a way to also reference report columns in this format mask?
    Thanks
    Luis

    Luis, did you finally resolve this? I have the same question.

  • Show File name as download link in a report

    Hi people,
    In an application (APEX 4.2.1) I have a reprot whith a file donwload column. I implemented the download as a BLOB column with "DOWNLOAD" as Format Mask. This works fine, I can download attachments, no probs so far. However, I want the Download Text to show the name of the actual file instead of a static text "Download".
    Any suggestions on this?
    Kind regards,
    Vincent Deelen

    Hi fac586,
    Thanks for your reply.Actually, my first thougt was to use #FILE_NAME# reference, I tried it again, but it doesn't really work for me. I end up with a download link that reads exactly "#FILE_NAME#".
    I've put up an example in my demo app to show:
    http://apex.oracle.com/pls/apex/f?p=vincentdeelen:31:0:::::
    I've included screenshots of the page setup in the report.
    Regards,
    Vincent

  • Display image for BLOB  Download link in Interactive Report

    I have a table containing BLOB data and am displaying the table in an interactive report. I would like to replace the "Download" text link with an icon that represents the MIME type of the BLOB, but can't seem to find a way to make the substitution. Does anyone know how to do this? Thanks.
    -Jeff

    Hey Ben,
    Thanks for the suggestion. I understand what you are saying, the problem is that when you have an interactive report that includes a BLOB and you use the built-in method for displaying a download link, it only gives you the option of using a text link. The method is outlined in the online help under:
    Home > Advanced Programming Techniques> About BLOB Support in Forms and Reports > About BLOB Support in Reports
    This is done by using the following syntax in the Number/Date Format of the column attribute of the BLOB:
    DOWNLOAD:CC_DOCUMENTS:CONTENTS:ID::MIME_TYPE:FILENAME:UPDATED_ON::attachment:View
    Where the last parameter is the link text. The only problem is that there is no option for substituting an image rather than the link text. That's what I'm trying to work around. Sorry if you new all of this already, but I wanted to explain what I've already done. Thanks for any help you can offer.

  • Re: Problem providing download link for BLOB data in apex report

    Hi Don,
    Your solution below worked but in the download option i only see save but not open for PDf file in the blob. Please let me know if you have any suggestion to achieve it
    Thanks
    Jo
    Problem providing download link for BLOB data in apex report 
    591953 Nov 19, 2008 1:55 PM (in response to 660436)
    Currently Being Moderated
    Good morning,
    Here is how I have solved this problem.
    1. The select statement in the sql for the report should not include the BLOB column. I decided to select only 2 columns, the column that has the key and the column with the filename.
    2. On the first column ( the primary key ) I put in the format statement that was simply DOWNLOAD:TABLENAME:BLOB_COLUMN:PRIMARY_KEY
    This works. I believe that the Oracle error I was getting was because I was trying to apply this format statement to the actual BLOB column.
    So, it appears that you can use any of the columns in the report to hold the DOWNLOAD format statement since in the format statement, you are defining the BLOB table, BLOB column and the primary key into that column.
    Hope this helps,
    Don.

    Branched out from a years old thread.
    user3003326 Don't post to old threads, please.

  • Problem providing download link for BLOB data in apex report

    Hi,
    I am trying to create a report on a table with BLOB data so that the report displays a "download" link for the BLOB data. I am trying to give users the ability to download files from a website.
    I have been following the instructions in OBE "Defining and Viewing BLOB Data in Oracle Application Express 3.1".
    In the report, for the BLOB column, I have specified values for the following fields in Report Attributes->Column Formatting->Number/Date Format->BLOB Download Format Mask:
    BLOB Table
    BLOB Column
    Primary Key Column 1
    MIME Type Column
    Filename Column
    BLOB Last Updated Column
    However, when I run the report, I get the following error, even thought there is data loaded into the table:
    report error:
    ORA-01403: no data found
    When I remove the BLOB Download Format Mask information for the BLOB column, then the data displays in the report, but without the "download" link for the BLOB data (which is expected):
    E.g.
    Title Author Created BLOB_CONTENT
    Siebel & RAC Best Practices     Erik.Peterson     17-SEP-08     [datatype]
    Siebel Grid Case Studies     Mark.MacDonald     17-SEP-08     [datatype]
    Siebel CRM Applications protected by Oracle Clusterware     Kelly.Tan     17-SEP-08 [datatype]
    Oracle Grid: The Optimal Platform for Siebel Solutions Mark.MacDonald 17-SEP-08     [datatype]
    Any ideas why I'm seeing the ORA_01403 when I specify the BLOB Download Format Mask?
    Edited by: user716599 on Sep 18, 2008 12:31 AM

    Good morning,
    Here is how I have solved this problem.
    1. The select statement in the sql for the report should not include the BLOB column. I decided to select only 2 columns, the column that has the key and the column with the filename.
    2. On the first column ( the primary key ) I put in the format statement that was simply DOWNLOAD:TABLENAME:BLOB_COLUMN:PRIMARY_KEY
    This works. I believe that the Oracle error I was getting was because I was trying to apply this format statement to the actual BLOB column.
    So, it appears that you can use any of the columns in the report to hold the DOWNLOAD format statement since in the format statement, you are defining the BLOB table, BLOB column and the primary key into that column.
    Hope this helps,
    Don.

  • Error when using format mask to create download link in report

    I'm following these directions to create a download link in a report region.
    http://docs.oracle.com/cd/E23903_01/doc/doc.41/e21674/advnc_blob.htm#HTMDB25905
    ######### Table Structure...
    desc document_library
    Name Null Type
    DOC_ID NOT NULL VARCHAR2(40)
    DATE_ADDED NOT NULL DATE
    FILE_CONTENT BLOB()
    FILE_NAME VARCHAR2(100)
    MIME_TYPE VARCHAR2(100)
    DOC_NUMBER NUMBER
    ###### Report Region...
    select a.*, dbms_lob.getlength(file_content) length
    from document_library a
    ###### Download Link Column...
    Date Format: DOWNLOAD:DOCUMENT_LIBRARY:FILE_CONTENT:DOC_NUMBER::MIME_TYPE:FILE_NAME:::attachment:Download
    ####### Results...
    report error:
    ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    The report region displays no rows (even though there is one row in the table), no links, and even more strange, it show the value of APP_USER where it would normally display the results.

    Josh,
    Your end result on page 58 and the instructions in that document link don't seem to correlate. Regardless, I:
    1) Copied page 58 to page 158 in your application.
    2) Removed the BLOB format mask from your report link.
    3) Changed your query to:
    select "ROWID",
    "DOC_ID",
    "DATE_ADDED",
    "USER_ID",
    dbms_lob.getlength("FILE_CONTENT") "FILE_CONTENT",
    "FILE_NAME",
    "MIME_TYPE",
    "DOC_NUMBER"
    from "#OWNER#"."DOCUMENT_LIBRARY"
    4) Specified the BLOB format mask for the FILE_CONTENT column.
    Seems to work just fine now (on page 158, that is).
    Joel

  • Access download link in an Interactive Report

    I've built an interactive report and one of the columns, File, is a download link. I assume the I can create a trigger to log when/who clicks on that link, because I have a trigger that runs when they first upload a file to the table that automatically grabs the SYSDATE and APP_USER. However, I don't know how to reference the download link. With the upload it is simply a button click, but the link is within the report and I can't seem to figure out how to interact with it. Any help would be appreciated.

    Hi,
    I think you can not use database trigger when someone select from table.
    I would create e.g. application process that handle loging and then "download" file.
    This might help you create code
    http://docs.oracle.com/cd/E14373_01/appdev.32/e13363/up_dn_files.htm#CIHDDJGF
    Regards,
    Jari
    http://dbswh.webhop.net/dbswh/f?p=BLOG:HOME:0

  • BLOB content download link on apex report

    Hi Guys,
    I have a simple form where user can attach file and save the records. I iterate through wwv_flow_files and get the file and save it to a custom table which has BLOB column. On another report page i display uploaded file details. What i need is, there must be a column with download link when user clink the link appropriate file should be downloaded. How can i do this ?
    Really appreciate if someone can assist me on this.
    Thanks Guys.

    See About BLOB Support in Forms and Reports.
    There's an OBE tutorial that followed the introduction of declarative BLOB support in 3.1 as well. (An earlier version but it is still relevant to APEX 4.x.)
    (Please make an effort to consult the documentation and thoroughly search the forum for previous coverage of a topic. This is a much discussed question.)

  • Link to URL from column in report

    I still trying to find a way to display a static file on a report page. I have been unsuccessful with using an HTML region using #APP_IMAGES#filename.sh or using the value found in the coulmn: #APP_IMAGES#&P28_SCRIPT.
    Now, I've added a link on the column of the report. The column itself contains the URL that I want to go to. For ex. http://sharepoint.bankofamerica.com/sites/GIM2000upgrade/Shared%20Documents/Supporting%20Documents/Scripts/ds_broker_gim.sh
    The URL for the Link in the Column Attributes is set to : &SCRIPT_SHAREPOINT_HTML..
    When I click on the column, it brings me to the APEX Logon???
    I've used this URL in a List Template in a Region on a page as the Target URL and it works fine??
    I'm thoroughly confused at this point.
    Can anyone offer any assistance with this? It's driving me crazy and holding up any further development I need to get done????
    Thank-You

    Scott,
    Thanks so much and it would be better just to go to the hosted site that i am prototyping. Sorry for the confusion.
    What I want to do is to drill-down to the unix script file. I have upload the file: ds_broker_gim.sh to Static files. I want to be able to display the contents of this file after the drill-down from the ASE_AUTOSYS table.
    If you logon to my workspace: WIM
    UserName: [email protected]
    Password: ireland
    1. From View Application - select the Application name : CGM
    2. Click on the ASE tab bringing you to p.2
    3. Click on AUTOSYS tab ( Go to p.30)
    4. From the AutoSys Search Select Pulldown - 5. Select 'GIM2_D_DS_CREATEBOKER_UX ' (PS is there a way to do a'smart select to scroll the list as you type?)
    6. Click on the column link in Autosys_Script (it should say' /vol01/apps/gim/scripts/ds_broker_gim.sh'
    7. Click on the AUTOSYUS_SCRIPT column
    8. Brings you to p.28 where I'm various things to get the shared file to display.
    Note: I added the field: SCRIPT_FILE to the table AUTOSYS_SCRIPTS as a CLOB. I thought, well If I can't get it via an URL or as a static document- let me try storing the code in a clob field. As you can see, I'm having no success in displaying the ontents of the static file or contents of the column field.
    Also note that on P.2, I have include the URL in a List Tmplate : 'Document's. When i click on this, it does go to the URL. You won't be able to use this as it is located in our firewall but at least it work but not what I want.
    If you could help me with this, I would be very gratefult to you. I'm ploying away doing this on own and certainly I've got a lot to learn but at the same time I've managed to get quite a bit done.
    Thankks so much for your help. I hope I've explained this better.

Maybe you are looking for

  • Encoding tag in C++ parser.

    Hi, Is there a way to obtain the encoding tag from the DOM Document after parsing in C++ parser. Appreciate your help. Thanks -Vijay

  • Use of options in aggregates

    Hi all, Someone please enlighten me on the use of options in aggregates:- 1) "propose query defination" 2 )" propose from bw statistics" 3) "propose from bw statistics (tables") 4)  "propose from last navigation" 5)  "propose from statistics usually

  • Not able to see iphone OS in Xcode

    Hi Guys, I am using OS X Mountain Lion 10.7.3 and installed Xcode 3.1.3. When I am opening Xcode to build an iPhone app it shows me only MAC OS X. Here is the screenshot of my screen. http://screencast.com/t/2VEXlRfyJdA Can anybody assist me with thi

  • UNIX command via Java?

    Hello all, one of the useful commands in unix is sed I would like to use the functionality of sed in Java. Is there any free java api where I can send a command like sed -n pos1,pos2p filenamethanks Aykut

  • HT1338 Aperture will not open after update? What do I do?

    Aperture will not open after I updated. What do I do?