Maximo

 View Only
  • 1.  Birt Report with secured attachment

    Posted Mon May 08, 2023 11:34 AM

    Hello Everyone,

    I need to create a custom Birt report for the work order. The attachment (photos) is required to display in the specific section in the report and secured attachment is enabled. Is there any way to get the secured attachment url? Or how could I display it in the report?

    Thanks in advance.



    ------------------------------
    Daniel Leung
    ------------------------------


  • 2.  RE: Birt Report with secured attachment

    Posted Mon May 08, 2023 11:45 AM

    Daniel,

    One simple option is to reference the local file path (from the context of the server) rather than the URL (using docinfo.urlname). The major limitation to this option is that it doesn't support the browser view, only the PDF version of the report.

    If this report is something that is run via Direct Print or scheduled this is probably your quickest path to success.



    ------------------------------
    Tim Ferrill
    Solutions Consultant
    Intelligent Technology Solutions
    tferrill@webuildits.com
    www.webuildits.com
    @tferrill/@webuildits
    ------------------------------



  • 3.  RE: Birt Report with secured attachment

    Posted Wed May 10, 2023 05:48 AM

    Thanks Tim.

    Just tried using docinfo.urlname as you suggested and the result is as you mentioned. I can now use direct print or export the report with secured attachment.

    Thank you very much



    ------------------------------
    Daniel Leung
    ------------------------------



  • 4.  RE: Birt Report with secured attachment

    Posted Wed May 10, 2023 09:45 PM

    Hi Tim

    The image can be show in preview for added below code on the image on create with dynamic image and just only input '' in the dynamic image expression

    importPackage(Packages.java.io);
    importPackage(Packages.java.lang);
     
    var file = new File(row["urlname"] );
    var ist = new FileInputStream(file);
    var lengthi = file.length();
     
    bytesa = new ByteArrayOutputStream( lengthi);
    var c;
    while((c=ist.read()) != -1){
             bytesa.write(c);
    }      
    ist.close();
    this.data = bytesa.toByteArray();

    Regards,
    Jason



    ------------------------------
    Jason Pun
    Technical Consulant
    Lexco
    (852) 2332 3262
    ------------------------------