Saturday, February 25, 2012

missing image

Hey
Im trying to display an image in a report in .PDF, but the problem is,
that there will not allways be an image. Im retrieving the image from
the database (MS SQL Server) but the table with the images is left
outer joined with some other tables ie. it will allways return a row,
but not allways will the content field contain an image.
Ive tried the following in the value property of the image item:
=First(Fields!Content.Value)
Results in the report timing out whenever theres no image. The report
never shows.
=iif(Trim(Fields!Content.Value) = "", Nothing, Fields!Content.Value)
Results in a red cross in the report where the image should be. It
doesnt matter wether theres an image or not, it just shows the red
cross.
I would like it not to show anything if theres no image, and if there
is an image, to show the image.
Anyone Please help
Regards
Jimmywell in sql server there is a function named DATALENGTH(ImageDataField)
and returns no of bytes occupied by the image
u should use this to check how many bytes r of a pic better to make a
calculated field in ur data set
then use this calculated field to hid or show the image in the report
by using the following expression in the HIDDEN property of the IMAGE
=iif(imagelengthfield.value=1,true,false)
when image wont b avaiable ur this calculated field ll return 1
otherwise some bigger value representing bytes of the image
u can further go to restrict data set by using
datalength(imageDatabaseField)>1 to come up in the dataset of the
report with the records having images only
choice is urs
take care
regards|||Hey
Actually what did the trick was to specify the dataset name. Dont know
why, it took me very long time, but it was after reading your post that
i found the solution, so thank :)
Jimmy

No comments:

Post a Comment