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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditionally insert .bmp objects in Crystal report

Status
Not open for further replies.

lana123

Programmer
Aug 20, 2003
79
US
Hi, people
Unfortunately, I never work with .bmp files(actually with all type of pictures)in Crystal and I would be happy to get any tips how to do my task:
I need conditionally show different .bmp objects in the Crystal Report IX (database - Oracle 9).
This is how they have to appear - if Field1 = LastName1 so .bmp1 have to be visible and printed with all other information on the form, if Field1 = LastName2 -> .bmp2 have to be visible and printed on the form(and so on)
I really appreciate any help.
Thanks in advance.
Lana
 
I have only done this once......

Ill share my thoughts but Im sure someone else will have a better solution. If the picture field is a bmp then it is what I guess Crystal refers to as a BLOB (Binary Large Object) .... You cant use BLOBS in a formula.

So what I have done in the past to conditionally show pictures like you are talking about is it overlay them and supress them based on the formula you need...

For example.. Place the picture you want if the field and the lastname1 equal in your report. Right click and select format graphic. Under the common tab click supress then the X2 button out to the right. enter this formula in the appropriate crystal syntax
//
{field1}={lastname2}

repeat this for the picture you want to be visible if the field = lastname2 but change the formula to
//
{field1}={lastname2}

Position the second picture exactly over the first and run your report...

_____________________________________
Crystal Reports XI Developer Version
Intersystems Cache 5.X ODBC connection

 
whups ... copy and paste got me ... the second formula should be
//
{field1}={lastname1}

_____________________________________
Crystal Reports XI Developer Version
Intersystems Cache 5.X ODBC connection

 
CoSpringsGuy,

Shouldn't the second formula be:

{field1}<>{lastname2}

That way the image will display if the field = lastname2?
 
I think either way would work I believe.... as long as you consider my copy and paste typo
:D

_____________________________________
Crystal Reports XI Developer Version
Intersystems Cache 5.X ODBC connection

 
CoSpringsGuy,
Thank you very much for the answer - but the main problem is not how how to swich/suppress the pictures connecting to the different Field values(I understand this) - I don't know how to show these pictures into the formula(and to what object I can attach this formula - because OLE object with .bmp extention in the Crystal report doesn't have any properties )
For example:
if Field1 = Lastname1 then
Picture1(don't know how to present this file)
else if Field1 = Lastname2 then
Picture2(don't know how to present this file)
May be I have to place each picture into the new test object, put these text objects one onto another and suppress them conditionnally?
Thank you,
Lana
 
Suppressing them conditionally is exactly what I was explaining above.

_____________________________________
Crystal Reports XI Developer Version
Intersystems Cache 5.X ODBC connection

 
I have tried a somewhat different approach to a 'conditional' image in a report.

I have the image in a subreport, and then used the 'Graphic Location' button under the 'Picture' tab after inserting a placeholder image and choosing 'Format Graphic'.

For the Graphic Location I used this:

"Q:\Pictures\"&{CLIENT.NameLast}&{CLIENT.NameFirst}*".bmp"

This way, i have a directory of images that are easily updated and as long as the pic are named correctly (ie: NameLastNameFirst.bmp) they appear nicely in the report.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top