1 2 Previous Next 16 Replies Latest reply on Jan 21, 2019 3:18 PM by Laury

    Display a BLOB in an Interctive Grid Report

    Laury

      Hi,

       

      I am working with APEX 5.1.2.

      I have an Interctive Grid Report on a region.

      The report is made from a query that contains a BLOB image.

      Does someone know how to display a BLOB image (or any BLOB) in such an Interctive Grid Report?

       

      Thanks and Regards.

        • 1. Re: Display a BLOB in an Interctive Grid Report
          Mahmoud_Rabie

          Hi Laury

           

          I hope the following thread helps you

          Image Column in Interactive Grid?

           

          Regards

          Mahmoud

          • 2. Re: Display a BLOB in an Interctive Grid Report
            Laury

            Hi Mahmoud,

             

            Thanks for your reaction.

            But, I do not understand the answer in that link.

            Can you explain the principle to achieve it?

             

            Kind Regards.

            • 3. Re: Display a BLOB in an Interctive Grid Report
              Laury

              In the link you posted, where is the BLOB column in your query?

              • 4. Re: Display a BLOB in an Interctive Grid Report
                Mahmoud_Rabie

                Laury wrote:

                 

                Hi Mahmoud,

                 

                Thanks for your reaction.

                But, I do not understand the answer in that link.

                Can you explain the principle to achieve it?

                 

                Kind Regards.

                Sure

                 

                If you check Page 3 of Sample Database Application from Packaged Applications, you would find the following query

                 

                select p.product_id,  
                       p.product_name,  
                       p.product_description,  
                       p.category,  
                       decode(p.product_avail, 'Y','Yes','N','No') product_avail,  
                       p.list_price,  
                       (select sum(quantity) from demo_order_items where product_id = p.product_id) units,  
                       (select sum(quantity * p.list_price) from demo_order_items where product_id = p.product_id) sales,        
                       (select count(o.customer_id) from demo_orders o, demo_order_items t where o.order_id = t.order_id and t.product_id = p.product_id group by p.product_id) customers,  
                       (select max(o.order_timestamp) od from demo_orders o, demo_order_items i where o.order_id = i.order_id and i.product_id = p.product_id) last_date_sold,  
                       p.product_id img,  
                       apex_util.prepare_url(p_url=>'f?p='||:app_id||':6:'||:app_session||'::::P6_PRODUCT_ID,P6_BRANCH:'||p.product_id||','||3,p_dialog=> 'null') icon_link,  
                       decode(nvl(dbms_lob.getlength(p.product_image),0),0,null,  
                       '<img alt="'||apex_escape.html_attribute(p.product_name)||'" title="'||apex_escape.html_attribute(p.product_name)  
                              ||'" style="border: 4px solid #CCC; -moz-border-radius: 4px; -webkit-border-radius: 4px;" '  
                              ||'src="'||apex_util.get_blob_file_src('P6_PRODUCT_IMAGE',p.product_id)||'" height="75" width="75" />') detail_img,  
                       decode(nvl(dbms_lob.getlength(p.product_image),0),0,null,  
                       apex_util.get_blob_file_src('P6_PRODUCT_IMAGE',p.product_id))  
                       detail_img_no_style,  
                       tags  
                from demo_product_info p
                

                 

                 

                detail_img contains the function apex_util.get_blob_file_src which gets the BLOB into src to be used in the HTML tag : img

                 

                I hope it is clear

                 

                Regards

                Mahmoud

                1 person found this helpful
                • 5. Re: Display a BLOB in an Interctive Grid Report
                  Laury

                  Hi,

                   

                  I still do not understand.

                   

                  I have a query for the report that looks like:

                  select first_name, last_name, your_photo from recoreded_persons;

                  first_name, last_name are defined as varchar2 in the database.

                  your_photo is defined as BLOB.

                  BLOB are not displayed in the interactive report.

                  I have no item in my page.

                   

                  In your piece of code below, there is a reference to P6_PRODUCT_IMAGE.

                  What is that? Is that an item.

                  Can you explain me the principle I should you to display a BLOB in the interactive grod report.

                  Can you explain me how it works?

                   

                  Kind Regards.

                  • 6. Re: Display a BLOB in an Interctive Grid Report
                    Mahmoud_Rabie

                    (1) Here is the Page 3 which I told you about

                    https://apex.oracle.com/pls/apex/f?p=55344:3

                    test

                    test1234

                     

                    (2) Yes, P6_PRODUCT_IMAGE is a page item. It is just needed by the function.

                    Name of valid application page ITEM that with type FILE that contains the source type of DB column

                    You could find it in Page 6. Please take a look at

                    https://docs.oracle.com/database/apex-18.1/AEAPI/GET_BLOB_FILE_SRC-Function.htm#AEAPI129

                     

                    Did you install the packaged application and check page 3 and page 6?

                    • 7. Re: Display a BLOB in an Interctive Grid Report
                      Laury

                      Hi,

                       

                      No, I didn't iinstalled the packaged application.

                      I would like first to understand how it works.

                      I cannot access Page 3 you mentioned, I get an error.

                       

                      So, if I well understand, I need page=5 to have the report defined on it, and page=6 a form that will contain items type like P6_PRODUCT_IMAGE.

                      Am I correct?

                      Yet, when I create an interactive grid report, there is no form associated with it.

                      Should I create a form page?

                       

                      Kind Regards.

                      • 8. Re: Display a BLOB in an Interctive Grid Report
                        Mahmoud_Rabie

                        No, I didn't iinstalled the packaged application.

                        I would like first to understand how it works.

                        I cannot access Page 3 you mentioned, I get an error.

                        You have to install it to be able to learn by example.

                        This is a running example

                        https://apex.oracle.com/pls/apex/f?p=34661:3

                        test

                        test1234

                         

                        So, if I well understand, I need page=5 to have the report defined on it, and page=6 a form that will contain items type like P6_PRODUCT_IMAGE.

                        Am I correct?

                        Yet, when I create an interactive grid report, there is no form associated with it.

                        Should I create a form page?

                        I didn't mention Page 5 !!

                         

                        Please concentrate in the expression of detail_img.

                        '<img alt="'||apex_escape.html_attribute(p.product_name)
                                    ||'" title="'||apex_escape.html_attribute(p.product_name)    
                                    ||'" style="border: 4px solid #CCC; -moz-border-radius: 4px; -webkit-border-radius: 4px;" '    
                                    ||'src="'||apex_util.get_blob_file_src('P6_PRODUCT_IMAGE',p.product_id)
                                    ||'" height="75" width="75" />')  detail_img,    
                        

                         

                        And specially in

                        apex_util.get_blob_file_src('P6_PRODUCT_IMAGE',p.product_id)
                        

                         

                        I have only mentioned Page 3 and Page 6. By the way, Page 6 is a Dialog Page that contains an item for the image P6_PRODUCT_IMAGE which is displayed after you click on the link of product name in the report

                         

                        I hope that helps

                         

                        Regards

                        Mahmoud

                        1 person found this helpful
                        • 9. Re: Display a BLOB in an Interctive Grid Report
                          fac586

                          Laury wrote:

                           

                          I still do not understand.

                           

                          I have a query for the report that looks like:

                          select first_name, last_name, your_photo from recoreded_persons;

                          first_name, last_name are defined as varchar2 in the database.

                          your_photo is defined as BLOB.

                          BLOB are not displayed in the interactive report.

                          I have no item in my page.

                           

                          In your piece of code below, there is a reference to P6_PRODUCT_IMAGE.

                          What is that? Is that an item.

                          Can you explain me the principle I should you to display a BLOB in the interactive grod report.

                          Can you explain me how it works?

                          get_blob_file_src is used to display and download data from BLOBs stored in custom tables. This requires that the application has:

                           

                          • A page containing a File Browse item with settings that refer to a BLOB and associated metadata columns in a table. This is normally the item used to load files into the BLOB column.
                          • An ARF DML process for fetching a row from that table.

                           

                          The name of the File Browse item is the first parameter passed to get_blob_file_src. This method uses a combination of item and ARF metadata, and the PK parameter value(s) to generate a URL that calls a public procedure that retrieves the BLOB content from the table and downloads it to the client.

                           

                          However, get_blob_file_src can be used even where the BLOBs are not uploaded through the app, by the simple expedient of creating the necessary File Browse item and ARF process on a page in the application, and hiding them using a Never server-side condition. This makes it a fairly flexible way to output images and download files, usually without needing to create any additional components.

                          I have a query for the report that looks like:

                          select first_name, last_name, your_photo from recoreded_persons;

                          first_name, last_name are defined as varchar2 in the database.

                          your_photo is defined as BLOB.

                          How do images get loaded into the YOUR_PHOTO column in the "RECOREDED_PERSONS" table in your database?

                          1 person found this helpful
                          • 10. Re: Display a BLOB in an Interctive Grid Report
                            Eslam_Elbyaly

                            I think you can make use of the declarative support for BLOB columns in Apex and avoid writing code. I do not know if it's applicable for your Apex version but,

                            1- create the database columns that supports the blob column.

                            1- the blob column.

                            2- MIME_TYPE.

                            3- FILENAME.

                            4- LAST_UPDATED.

                            5- CHARACTER_SET.

                             

                            - In your report, just make the column as a display image type and set the blob column as it's source.

                             

                            provide credentials to login in to your app's page on apex.oracle.com so we can help you faster.

                            1 person found this helpful
                            • 11. Re: Display a BLOB in an Interctive Grid Report
                              fac586

                              Eslam_Elbyaly wrote:

                               

                              I think you can make use of the declarative support for BLOB columns in Apex and avoid writing code.

                              Not so. As previously discussed, Interactive Grids have no support for declarative BLOB rendering:

                               

                              1 person found this helpful
                              • 12. Re: Display a BLOB in an Interctive Grid Report
                                Laury

                                Hi,

                                 

                                Well, if I understand well, if I want to display a BLOB in an initeractive report, I need to have an item, typically a form item from another page (a form page).

                                Is that correct, the only way tp do it?

                                I can achieve this result when I have a report and a form (or page containing the item that will hold the BLOB).

                                Like this, using apex_util.get_blob_file_src, I get the desired result.

                                Indeed, it seems I cannot get it on an interactive grid report.

                                 

                                @Mahamoud:

                                I meant page=3 and not 5 (my mistake).

                                But if I click on the above link, I get "page not available".

                                I do not which to download the application you spoke about.

                                I do not wish to decipher the code, but instead to understand on a higher level how it works.

                                At a later stage, I can download or or make my own sample (what I usually prefer to do).

                                 

                                @fac586:

                                I still have to explore the last links you posted.

                                 

                                Kind Regards

                                • 13. Re: Display a BLOB in an Interctive Grid Report
                                  fac586

                                  Laury wrote:

                                   

                                  Well, if I understand well, if I want to display a BLOB in an initeractive report, I need to have an item, typically a form item from another page (a form page).

                                  Is that correct, the only way tp do it?

                                  No, there are multiple options for displaying and downloading BLOB content in an interactive report:

                                   

                                  1. Declarative BLOB support
                                  2. The apex_util.get_blob_file_src API
                                  3. A custom On-Demand Process
                                  4. A RESTful web service

                                   

                                  All have their place depending on the use case involved, the source of the data, the application design, and the deployment environment.

                                  I can achieve this result when I have a report and a form (or page containing the item that will hold the BLOB).

                                  Like this, using apex_util.get_blob_file_src, I get the desired result.

                                   

                                  Indeed, it seems I cannot get it on an interactive grid report.

                                  Declarative BLOB support is missing from interactive grids. It is entirely possible to use the other three methods. apex_util.get_blob_file_src is the simplest of these if the items and processes required to maintain the BLOB data exist in the same application, as it does not require the creation of any additional components.

                                  1 person found this helpful
                                  • 14. Re: Display a BLOB in an Interctive Grid Report
                                    Laury

                                    Hi

                                     

                                    Well, if I want to display a BLOB in my report I need to use a classic interactive report, and not the (new) interactive grid report.

                                    If I understand weel, The apex_util.get_blob_file_src API, A custom On-Demand Process, are options for the interactive reports.

                                    But I do not understand how to use the Declarative BLOB support in a report. I also do not understand how to use A RESTful web service in an interactive report.

                                     

                                    Kind Regards.

                                    1 2 Previous Next