cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Presentation Template - dynamic adress for embedded images

cpabst
1-Newbie

Presentation Template - dynamic adress for embedded images

Dear Community,

I would like to add a tab to a presentation template showing additional (graphical) information for the specific item.

The Template only allows static URL for the image address. Is there any chance to make the adress to the image dynamic. In other words a specific address for each item ID?

To make thins clearer:

Item ID 12001

image adress: www.myfancygraphics.com/12001.jpg

Item ID 12002

image adress: www.myfancygraphics.com/12002.jpg

Background: we would like to render a few graphics showing complex relationships etc. We would render these images with nightly job, and load them into the items.

Any creative ideas how to solve this issue? Would be a great help.

Thanks in advance.

Chris

1 ACCEPTED SOLUTION

Accepted Solutions
smccoy
1-Newbie
(To:cpabst)

Hi Chris,

Yes. I believe that you can use the "Text Override" to inject HTML. We don't utilize that capability of Integrity because I don't believe that it can support injecting content that changes.

We have solved this problem by injecting html content into a longtext field with richcontent enabled. I recommend setting the longtext field as read-only and use trigger/scripts to set the value; which is where you can place the logic to handle altering the image..You'll have to play with the height and width parameters, and the "Display Rows" attribute of the longtext field to get the display the way you want it.

This approach does work in both the WebClient and ThickClient tools.

It's not a perfect solution, for certain, but it's better than making do with nothing. The script example below should get you close. If needed, you can make this more flexiable and robust by using parameters. No need to add that complexity to start, though.

-Sean

// pre-trigger script.

// Initialize variables

var eb = bsf.lookupBean("siEnvironmentBean");

var sb = bsf.lookupBean("imServerBean");

var delta = bsf.lookupBean("imIssueDeltaBean");

var params = bsf.lookupBean("parametersBean");

// ** create the logic needed to determine the image by building a string that is like the following line

var myHTMLContent ="<!-- MKS HTML --><img src='http://mks1.XXXXX./'<itemID>.jpg" alt="rendered content" height='420' width='420'>"

delta.setFieldValue("Custom Image Field" , myHTMLContent ); //Sets the longtext field called "Custom Image Field" in an item that was changed. Be sure the item is visible in the type.

View solution in original post

3 REPLIES 3
smccoy
1-Newbie
(To:cpabst)

Hi Chris,

Do you use the Client Tool, the Web Tool, or both?

With the Client Tool, I believe that your options are limited, or in other words, I don't think that it can be done. PTC support can chime in to give other possible options.

If you're using the Web Tool, you can take much more control of the UI using JavaScript, HTML and CSS and actually accomplish exactly what you're describing. It's not for the "faint of heart" however, and an approach that is not "officially supported" by PTC.

If you're using the Web Tool, you also have the option of creating a custom JSP page to accomplish this as well. Which is an approach to customization that is better aligned with PTC's support policies. Of course, this approach comes with its set of pros and cons as well.

If you'd like an "Out ot the Box" supported approach, you can create a report with your own custom HTML and JavaScript that provides the feature that you need. This solution isn't integrated into the UI and on a separate tab as you're describing. But it is is a mechanism to accomplish something close.

Good luck with your project

-Sean

cpabst
1-Newbie
(To:smccoy)

Hi Sean,

thanks for the response. We focus on the Client. The Web UI is usually only used by users that aren't using the system regularly.

I had another idea that might allow, what I am looking for, but I couldn't make it work yet.

I remembered that the 'Text Override' can handle <html> content. It even allows to inject an image, but what I would need is to read the item ID somehow to use it as a dynamic part of the image adress.

Any idea how to make this work? So the tag should look something like this

<html> <img src="http://mks1.XXXXX./<itemID>.jpg" alt="rendered content" height="420" width="420"></html>

But I have no idea to give him the item ID. {ID} and similar did not work. If someone knows a way around this it would be amazing.

Thanks in advance.

Best Regards,

Chris

smccoy
1-Newbie
(To:cpabst)

Hi Chris,

Yes. I believe that you can use the "Text Override" to inject HTML. We don't utilize that capability of Integrity because I don't believe that it can support injecting content that changes.

We have solved this problem by injecting html content into a longtext field with richcontent enabled. I recommend setting the longtext field as read-only and use trigger/scripts to set the value; which is where you can place the logic to handle altering the image..You'll have to play with the height and width parameters, and the "Display Rows" attribute of the longtext field to get the display the way you want it.

This approach does work in both the WebClient and ThickClient tools.

It's not a perfect solution, for certain, but it's better than making do with nothing. The script example below should get you close. If needed, you can make this more flexiable and robust by using parameters. No need to add that complexity to start, though.

-Sean

// pre-trigger script.

// Initialize variables

var eb = bsf.lookupBean("siEnvironmentBean");

var sb = bsf.lookupBean("imServerBean");

var delta = bsf.lookupBean("imIssueDeltaBean");

var params = bsf.lookupBean("parametersBean");

// ** create the logic needed to determine the image by building a string that is like the following line

var myHTMLContent ="<!-- MKS HTML --><img src='http://mks1.XXXXX./'<itemID>.jpg" alt="rendered content" height='420' width='420'>"

delta.setFieldValue("Custom Image Field" , myHTMLContent ); //Sets the longtext field called "Custom Image Field" in an item that was changed. Be sure the item is visible in the type.

Top Tags