Oracle Analytics Publisher

Welcome to the Oracle Analytics Community: Please complete your User Profile and upload your Profile Picture

Big problem to integrate dinamic images in RTF template

Accepted answer
168
Views
8
Comments

I have a very strange and in the same time big problem when I tried to integrate images (link of images) in my RTF template in BI Publisher.
So this is the started situation, I have one Dataset with a field with the link of the image in internet, something like that:
"https://link/pippo.png" in the field named FLAG_URL.

To add this image in the RTF I have followed two different ways. The first way was use the BI Publisher Add-In, click on add Field, adding the field FLAG_URL, and after that in Advanced TAB changed from <?FLAG_URL?> to <fo:external-graphic src="url(<?FLAG_URL?>)"/>.
In this case the image did not showed at all, no errors but the image was not showed. To see if the syntax was correct I tried to use a link without the variable from the dataset, and it worked! So the problem seemed to be the use of the FLAG_URL, but if in the RTF I try to show this value, the value is showed. I tried to use this code instead of : <fo:external-graphic src="url(<?FLAG_URL?>)"/>.

<fo:external-graphic src="url(<?FLAG_URL?>)"/>

And it was showed the image in the static url, this means that internally to the Field container FLAG_URL is empty, but it is not empty for sure, the XML is really good formed.

The second way was added one Image from "Insert Image" of the RTF, and changing the Alternate Text of the image, inserting inside this text
url:{'<?FLAG_URL?>'}
it did not work and as before it worked for:
url:{'https://link/pippo.png'}
So at the end the problem seems to be related to the FLAG_URL that seems to be empty, but it is filled for sure. Probably it did not recognize the value for some reasons ?

Please help me, I do not know what I can do now…..
Thanks
Fabio

Best Answer

Answers

  • user8945294
    user8945294 Rank 3 - Community Apprentice

    Sorry Sandeep,

    this is a similar solution I have used, it lacks in some syntax detail but is similar. If you have read what I have written the problem is more deep. I have problems in the embedding I think.

    So I ask yet help from someone that have had a similar issue than mine, or that know for sure how I can write the code for dynamic images.

    Thanks!

    Fabio

  • Sandeep S. Chauhan-Oracle
    edited Sep 19, 2024 12:55PM

    I tried with sample Image URL with following syntax and its working fine for me.

    url:{FLAG_URL}

    You might need to check if you are giving right XPATH for your image element

    for ex: url:{DATA_DS/G_2/G_7/FLAG_URL}

  • user8945294
    user8945294 Rank 3 - Community Apprentice

    I have used the correct xpath, see this example.
    I have inserted two elements, one within a field object named FLAG_URL which contains the same text than the text directly written in RTF.

    image.png

    after the execution of the report I have this result:

    image.png

    the red circle could contains the image from the link build using the variable from XML, but it could not possible to have, and seeing the second part of the RPT you can see that the link has been created correctly.
    Why this different behavior ?

  • user8945294
    user8945294 Rank 3 - Community Apprentice

    Sorry Sandeep,

    this is a similar solution I have used, it lacks in some syntax detail but is similar. If you have read what I have written the problem is more deep. I have problems in the embedding I think.

    So I ask yet help from someone that have had a similar issue than mine, or that know for sure how I can write the code for dynamic images.

    Thanks!

    Fabio

  • Sandeep S. Chauhan-Oracle
    edited Sep 19, 2024 3:50PM

    Hi @user8945294 ,
    Have you tried second way(which you have mentioned in OP) with syntax I have shared with you? What is your output type? (HTML is supported output format for URL Image) , Can you share RTF and sample XML data for understanding the issue?

  • user8945294
    user8945294 Rank 3 - Community Apprentice

    At the end your advise was the solution of my problem.
    I just have had to use your solution and the complete xpath, this is what I have written in the Alternate text:
    url:{/DATA_DS/G_4/FLAG_URL_2}
    I did not understand why in the other sections of the RTF it was enough the use of the simple field name :

    <?FLAG_URL_2?> instead of the use the complete path.

    And another question is, why it does not work with this instuction:
    <fo:external-graphic src="url('/DATA_DS/G_4/FLAG_URL_2')"/>
    in the form field object ?
    however , many thanks for your precious help!
    Fabio

  • user8945294
    user8945294 Rank 3 - Community Apprentice

    Thanks Sandeep,

    at the end I could have a good result following your advise!

    It was a combination of changes to have a good result.

    This is what I have written at the end: url:{/DATA_DS/G_4/FLAG_URL_2}

    The strange thing is that without the use of the complete XPATH the rest of the RPT works, and just for the image it needed the use of complete xpath.

    I just do not understand why it does not work in this way:
    <fo:external-graphic src="url('/DATA_DS/G_4/FLAG_URL_2')"/>
    within the field form.

    But, many thanks for your precious help!

    Fabio