Monday, March 26, 2012

hide a database image when there is no image in database

well i ve an image field in database and then using an image in a
report that is connected with the image database field (carrying image
details in bits) what i want is to hide the image in report when the
image field in database is null (image database field is 0x00 when it
contains NO IMAGE)
i m trying to put following expression in the HIDDEN property of the
IMAGE in the report :
=iif(Fields!image.value=NOTHING,true,false)
but it says that this expression cant b put probably (rather surely)
coz of the datatype of image database field (BIT) so plz help me out
how to do that i ve also tried
iif ( isnothing(Fields!image.value)=NOTHING,true,false)
then it doesnt give error but it always return NON-NULL VALUE (ie
always returns false part of the expression) even the image database
field is EMPTY is (0x00)
how to resolve that issue any suggestion
thanx in advanceHey Spirits,
How about changing your SQL query to something like this:
SELECT imgImage, CASE WHEN imgImage IS NULL THEN 0 ELSE 1 END AS
bitImageExists
FROM tblSomethingImage
And then set the Hidden expression for the image to
"=IIf(Fields!bitImageExists.Value = 1, False, True)"?
Cheers,
-Geoff R G Williams
Primal Blaze Ltd.
"** Spirits **" <muhammadhammad78@.gmail.com> wrote in message
news:1124863203.576215.182520@.g47g2000cwa.googlegroups.com...
> well i ve an image field in database and then using an image in a
> report that is connected with the image database field (carrying image
> details in bits) what i want is to hide the image in report when the
> image field in database is null (image database field is 0x00 when it
> contains NO IMAGE)
> i m trying to put following expression in the HIDDEN property of the
> IMAGE in the report :
> =iif(Fields!image.value=NOTHING,true,false)
> but it says that this expression cant b put probably (rather surely)
> coz of the datatype of image database field (BIT) so plz help me out
> how to do that i ve also tried
> iif ( isnothing(Fields!image.value)=NOTHING,true,false)
> then it doesnt give error but it always return NON-NULL VALUE (ie
> always returns false part of the expression) even the image database
> field is EMPTY is (0x00)
> how to resolve that issue any suggestion
> thanx in advance
>|||geoff thanx for concern actually the solution u provided wont work as
i ve tried that n then i got another solution to my problem n i m
sharing it with u it is as followed
well 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

No comments:

Post a Comment