cancel
Showing results for 
Search instead for 
Did you mean: 

Variable Image

Former Member
0 Kudos

Is there a way to place an image on the page that works off the following information.

All images are located in the 'c:\Graphics' folder.

The image names are 'Generic Door####.bmp'.

The '####' is a Field name of {Doors.Door Num} this a number format.

Example {Doors.Door Num} = 186 image Generic Door0186.bmp.

So I would get the {Doors.Door Num} place it a formula and the image would be retrieved.

Is this possible?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Place an image in which ever section you need it in. RIGHT click on the image and click on Format Graphic.

Click on Picture tab, and then on the x+2 button next to Graphic Location.

In the formula workshop window type this:

'c:\Graphics\Generic Door0' & {Doors.Door Num} & '.bmp';

Save & Close and it should display the images of the various doors depending on the value of the field.

Try it and see if it works.

Former Member
0 Kudos

Ok I'm not getting an image. I just shows the image I started with.

I believe that the 'Generic Door0' & {Doors.Door Num} & '.bmp' isn't returning a proper value. When I type in Generic Door0906.bmp it works.

The only other thing I was going to mention was what if the {Doors.Door Num} is 1 or 10 or 1000.

Then I think I would have to check the length of {Doors.Door Num}

Maybe if then else statements...

How do you check the length of {Doors.Door Num}?

Thanks for your help....

Former Member
0 Kudos

If I type in this it works.

'C:\Graphics\Generic Door0' & '908' & '.bmp'

So I think it because {Doors.Door Num} is a number does it need to be changed to a text then added?

Former Member
0 Kudos

YES, that makes a difference.

Change the graphic location formula to:

'C:\Graphics\Generic Door0' & totext({Doors.Door Num},0,'','') & '.bmp'

Edited by: Sanjay Kodidine on Dec 10, 2008 10:05 PM

Edited by: Sanjay Kodidine on Dec 10, 2008 10:08 PM

Former Member
0 Kudos

Kewl it worked....

Thanks so much...

Now I'm trying to rewrite it to check length of {Doors.Door Num}

If length (totext({Doors.Door Num},0,'','')) = 1 then

'C:\Planit\Solid_4_2\Database\Graphics\Generic Door000' & totext({Doors.Door Num},0,'','') & '.bmp' Else

If length (totext({Doors.Door Num},0,'','')) = 2 then

'C:\Planit\Solid_4_2\Database\Graphics\Generic Door00' & totext({Doors.Door Num},0,'','') & '.bmp' Else

If length (totext({Doors.Door Num},0,'','')) = 3 then

'C:\Planit\Solid_4_2\Database\Graphics\Generic Door0' & totext({Doors.Door Num},0,'','') & '.bmp' Else

'C:\Planit\Solid_4_2\Database\Graphics\Generic Door' & totext({Doors.Door Num},0,'','') & '.bmp'

Got it...

Thanks again for your help...

Former Member
0 Kudos

Hi Jeff,

You can also use this to remove if condition

'C:\Planit\Solid_4_2\Database\Graphics\Generic Door' & replicatestring('0',4-length(trim(totext({Doors.Door Num},0,'',''))))+trim(totext({Doors.Door Num},0,'','')) & '.bmp'

if in future you have file name with more zero padded, you just need to change the value from 4 to whatever number you want..

thanks,

Parv

Former Member
0 Kudos

Kewl..

I always like less code.

Thanks

Answers (0)