Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert JPEG, PNG or TIFF image in Details Section with Conditional Logic 1

Status
Not open for further replies.

waterg2

Technical User
Aug 10, 2011
6
US
I have a need to insert an image file into the details section of the report using conditional logic. For instance, if location A then image A would be inserted, if location B then image B and so for. When I insert an image into the details section it repeats that image for all sections. The goal is for the image to be included once where each unique job code/location combination appears on a report.

Any recommendations on how to do this would be great appreciated. I have been struggling to figure this out, but coming up empty :/.

Regards,
Cervello
 

Right click on the image file, select Format Graphic from the pop-up menu.
On the Format Editor dialog box that opens up, under Common tab, click the Conditional Formula (x-2) button to the right of the Suppress check box.

Here you can add the condition needed to suppress the image
eg:For the first image [tt]{location}<>"Location A"[/tt] (You have to change this based on your requirement)

Insert second image and in the suppress condition for the second graphic you can add something like [tt]{location}<>"Location B"[/tt] and so on.

You also have to make align all the images and make all the same size.

Hope this helps.

 
I will give that a try.

Thank you for the quick response!!
Cervello
 
I'm getting the correct image for each location but a few undesirable things are still happening. The images are side by side in the section, so when the first image is suppressed the second image is displayed offset (not left justified). I tried stacking them, but that left tons of white space.

Example If I suppress image A it looks like this (offset):

[blank] Image B (offset one inch to account for image A's placement)

Also, I need this to show in the first section only. What I'm getting is an image for each grouped section. Currently, I have one group formula handling all the section headings.

I tried adding suppression criteria: {?Department}<> "FR" and {QUERY_.Type}<> 'GF' .
Type is a reference to the section "General Functions".

Any ideas are greatly appreciated!!
Cervello
 

You only have to insert one image to use dynamic graphic location - it doesn't matter which one you use since it's just a placeholder.

Once it's inserted, right click on the image and select Format Graphic. On the Picture tab you'll see 'Graphic Location' and it's here you will put the formula. Your logic will be something like:

if {LocationField} = "New York" then "c:\users\you\pictures\newyorkskyline.jpg"
else
if {LocationField} = "San Francisco" then "c:\users\you\pictures\sf.jpg"
else
if {LocationField} = "Tulsa" then "c:\users\you\pictures\tulsa.jpg"


This works with a relatively small number of pictures - for a large amount it would be better to create a database table that stores the location value and the path to the associated graphic. That also allows you to move the physical graphic locations and not have to modify the report, just the path field in the table.
 
That's the right way to do it. Was not aware of that.
Thanks Brian.
 
Thank you so much!!! That worked perfectly.
P.S. I appreciate the extra information about storing the path to the images in the database.

Sincerely,
Cervello
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top