Tribe,
I'm struggling with the poorly implemented image handling in SSRS
(which is represented through ASP.NET via
Microsoft.Reporting.WebForms)
First off, SSRS/Reporting team - External Images should mean exactly
that. The report should express EXACTLY what I enter into the Value
field for an External type image in a report. The fact that the engine
interprets and munges this field is an utter travesty. If I enter "/
myDBImageDumper.aspx" this text is what should be expressed out
through the Web report viewer. Period. The use of this property
"UnattendedExecutionAccount" in order to allow the report engine to
render local images is a complete and total hack
Now, in dealing with a simple database supplied image in the reporting
body of a report, I've got an Image type field in a SQLExpress table.
I've loaded this field through a web FileUpload and stored the bytes
in the field. I can render these bytes out through a web page by using
the Response.WriteBinary(reader[IMAGEFIELDPOS]);
I mention this as I know that the image now in the database in the
correct mime format (jpeg).
So, back to the report. I've added an image field to the body of the
report (I want it in the header by alas that is also an
impossibility). To this field I've assigned the mime type "image/
jpeg", the Source of Database, and a Value of:
=System.Convert.ToBase64String(Fields!UserCompanyImage.Value,
"InvoiceHeader_InvoiceHeader")
And of course the image does not render.
Adding that same value to a text field however allows the Base64 to
get dumped out in to that field. Which proves the data is there.
However, I'm baffled as to how to get this image to show up.
Clues anyone
DCTribe,
I lied. I can get the image to show up in the body of the report by
using just the straight byte dump:
=First(Fields!UserCompanyImage.Value, "InvoiceHeader_InvoiceHeader")
But what I'm really trying to do is to get the image up in the header.
So I've got another identical image up in the header and I've got its
Value set to :
=Reportitems!imageLogo.Value
Where imageLogo is the name of the first, body of the report, image.
The header image does not render.
Clues 2?
DC
On Oct 8, 2:44 pm, bangeye <davecl...@.gmail.com> wrote:
> Tribe,
> I'm struggling with the poorly implemented image handling in SSRS
> (which is represented through ASP.NET via
> Microsoft.Reporting.WebForms)
> First off, SSRS/Reporting team - External Images should mean exactly
> that. The report should express EXACTLY what I enter into the Value
> field for an External type image in a report. The fact that the engine
> interprets and munges this field is an utter travesty. If I enter "/
> myDBImageDumper.aspx" this text is what should be expressed out
> through the Web report viewer. Period. The use of this property
> "UnattendedExecutionAccount" in order to allow the report engine to
> render local images is a complete and total hack
> Now, in dealing with a simple database supplied image in the reporting
> body of a report, I've got an Image type field in a SQLExpress table.
> I've loaded this field through a web FileUpload and stored the bytes
> in the field. I can render these bytes out through a web page by using
> the Response.WriteBinary(reader[IMAGEFIELDPOS]);
> I mention this as I know that the image now in the database in the
> correct mime format (jpeg).
> So, back to the report. I've added an image field to the body of the
> report (I want it in the header by alas that is also an
> impossibility). To this field I've assigned the mime type "image/
> jpeg", the Source of Database, and a Value of:
> =System.Convert.ToBase64String(Fields!UserCompanyImage.Value,
> "InvoiceHeader_InvoiceHeader")
> And of course the image does not render.
> Adding that same value to a text field however allows the Base64 to
> get dumped out in to that field. Which proves the data is there.
> However, I'm baffled as to how to get this image to show up.
> Clues anyone
> DC|||Tribe,
Here's the trick (what a mess)
In order to get a dynamic JPEG image out of your database and into the
header of your report you must:
Add a textfield to the body of your report.
Assign the value of that textfield (call this text field
txtImageData):
= Convert.ToBase64String(Fields!MyImageStreamField)
Add an image type to your report header.
Assign the Mime type to image/jpeg and the Source to Database
Assign the value to :
= Convert.FromBase64String(ReportItems!txtImageData.Value)
Your image will then have the byte data that was originally in your
image column in your database table.
DC
On Oct 8, 3:04 pm, bangeye <davecl...@.gmail.com> wrote:
> Tribe,
> I lied. I can get the image to show up in the body of the report by
> using just the straight byte dump:
> =First(Fields!UserCompanyImage.Value, "InvoiceHeader_InvoiceHeader")
> But what I'm really trying to do is to get the image up in the header.
> So I've got another identical image up in the header and I've got its
> Value set to :
> =Reportitems!imageLogo.Value
> Where imageLogo is the name of the first, body of the report, image.
> The header image does not render.
> Clues 2?
> DC
> On Oct 8, 2:44 pm, bangeye <davecl...@.gmail.com> wrote:
> > Tribe,
> > I'm struggling with the poorly implemented image handling in SSRS
> > (which is represented through ASP.NET via
> > Microsoft.Reporting.WebForms)
> > First off, SSRS/Reporting team - External Images should mean exactly
> > that. The report should express EXACTLY what I enter into the Value
> > field for an External type image in a report. The fact that the engine
> > interprets and munges this field is an utter travesty. If I enter "/
> > myDBImageDumper.aspx" this text is what should be expressed out
> > through the Web report viewer. Period. The use of this property
> > "UnattendedExecutionAccount" in order to allow the report engine to
> > render local images is a complete and total hack
> > Now, in dealing with a simple database supplied image in the reporting
> > body of a report, I've got an Image type field in a SQLExpress table.
> > I've loaded this field through a web FileUpload and stored the bytes
> > in the field. I can render these bytes out through a web page by using
> > the Response.WriteBinary(reader[IMAGEFIELDPOS]);
> > I mention this as I know that the image now in the database in the
> > correct mime format (jpeg).
> > So, back to the report. I've added an image field to the body of the
> > report (I want it in the header by alas that is also an
> > impossibility). To this field I've assigned the mime type "image/
> > jpeg", the Source of Database, and a Value of:
> > =System.Convert.ToBase64String(Fields!UserCompanyImage.Value,
> > "InvoiceHeader_InvoiceHeader")
> > And of course the image does not render.
> > Adding that same value to a text field however allows the Base64 to
> > get dumped out in to that field. Which proves the data is there.
> > However, I'm baffled as to how to get this image to show up.
> > Clues anyone
> > DC
Showing posts with label struggling. Show all posts
Showing posts with label struggling. Show all posts
Wednesday, March 21, 2012
Image From DB - There but not there
Friday, February 24, 2012
IIF Statement Issue
Hi there.
There's an iif statement that I'm struggling with on Reporting Services.
This statement is on a calulated field. The iif statement is as follows:
=iif(x=0, 0, ((y-z)/x)*100).
In other words, if x is zero then 0 must be the output. Else the above
formula must be the output. The syntax is perfect, and so is the logic (i
think...). When I run the report it gives me a warning message that it cannot
"divide by zero". What is obviously happening is that x is zero, but instead
of displaying zero (as it is instructed to do so), it's going straight to the
formula!
Can anyone please tell me what's happening, and how I can make it work?
Thanks in advance.
(By the way, this has to be in Reporting Services and not sql)
--
Regards,You might have some cases where x is null which would not be getting handled
in your expression. add another iif test to check for nulls
"crmLearner" <crmLearner@.discussions.microsoft.com> wrote in message
news:1F6784D8-CBD8-494A-81DB-098E9E922CB4@.microsoft.com...
> Hi there.
> There's an iif statement that I'm struggling with on Reporting Services.
> This statement is on a calulated field. The iif statement is as follows:
> =iif(x=0, 0, ((y-z)/x)*100).
> In other words, if x is zero then 0 must be the output. Else the above
> formula must be the output. The syntax is perfect, and so is the logic (i
> think...). When I run the report it gives me a warning message that it
> cannot
> "divide by zero". What is obviously happening is that x is zero, but
> instead
> of displaying zero (as it is instructed to do so), it's going straight to
> the
> formula!
> Can anyone please tell me what's happening, and how I can make it work?
> Thanks in advance.
> (By the way, this has to be in Reporting Services and not sql)
> --
> Regards,|||Wow, i can't believe i didn't think of that...i'll give it a try.
Thanks!
--
Regards,
"Dean" wrote:
> You might have some cases where x is null which would not be getting handled
> in your expression. add another iif test to check for nulls
> "crmLearner" <crmLearner@.discussions.microsoft.com> wrote in message
> news:1F6784D8-CBD8-494A-81DB-098E9E922CB4@.microsoft.com...
> > Hi there.
> >
> > There's an iif statement that I'm struggling with on Reporting Services.
> > This statement is on a calulated field. The iif statement is as follows:
> > =iif(x=0, 0, ((y-z)/x)*100).
> >
> > In other words, if x is zero then 0 must be the output. Else the above
> > formula must be the output. The syntax is perfect, and so is the logic (i
> > think...). When I run the report it gives me a warning message that it
> > cannot
> > "divide by zero". What is obviously happening is that x is zero, but
> > instead
> > of displaying zero (as it is instructed to do so), it's going straight to
> > the
> > formula!
> >
> > Can anyone please tell me what's happening, and how I can make it work?
> > Thanks in advance.
> >
> > (By the way, this has to be in Reporting Services and not sql)
> > --
> > Regards,
>
>|||another thing to check for is empty strings, depending on how the data was
entered there may be "spaces" in the fields which are not 0 nor are they
null.
"crmLearner" <crmLearner@.discussions.microsoft.com> wrote in message
news:55531FF7-63F6-44C5-9F31-83A2C32B5BFA@.microsoft.com...
> Wow, i can't believe i didn't think of that...i'll give it a try.
> Thanks!
> --
> Regards,
>
> "Dean" wrote:
>> You might have some cases where x is null which would not be getting
>> handled
>> in your expression. add another iif test to check for nulls
>> "crmLearner" <crmLearner@.discussions.microsoft.com> wrote in message
>> news:1F6784D8-CBD8-494A-81DB-098E9E922CB4@.microsoft.com...
>> > Hi there.
>> >
>> > There's an iif statement that I'm struggling with on Reporting
>> > Services.
>> > This statement is on a calulated field. The iif statement is as
>> > follows:
>> > =iif(x=0, 0, ((y-z)/x)*100).
>> >
>> > In other words, if x is zero then 0 must be the output. Else the above
>> > formula must be the output. The syntax is perfect, and so is the logic
>> > (i
>> > think...). When I run the report it gives me a warning message that it
>> > cannot
>> > "divide by zero". What is obviously happening is that x is zero, but
>> > instead
>> > of displaying zero (as it is instructed to do so), it's going straight
>> > to
>> > the
>> > formula!
>> >
>> > Can anyone please tell me what's happening, and how I can make it work?
>> > Thanks in advance.
>> >
>> > (By the way, this has to be in Reporting Services and not sql)
>> > --
>> > Regards,
>>|||The parameters to the IIF function are all evaluated in order to call the
function. So in your case the CLR calculates three values to be passed as
parameters...
(x=0)
,(0)
,((y-z)/x)*100)
...and would then have internal logic that says if the first parameter is
true return the second parameter else the third parameter. But that logic
won't get fired as your third parameter is giving a divided by zero exception
when x is zero.
You could write a code function to go in the Report Properties' Code tab...
Function SafeDividePercent (ByVal numerator As Integer, ByVal denominator As
Integer) As Object
If denominator = 0 Then
Return 0
Else
Return ( numerator / denominator) *100.0
End If
End Function
... and then use it like this for a text box's Expression.
=Code.SafeDividePercent( Fields!y.Value - Fields!z.Value, Fields!x.Value)
Note that I've assumed your variables are integers but that the result isn't.
Someone may have another way of dealing with it.
Hope that helps,
Andrew|||Please ignore my previous answer - it is completely and utterly WRONG!
You CAN safely use IIF() to prevent a divide by zero.
That'll teach me to try before I post.
Now, where did I put that hair shirt?
Sorry for any confusion,
Andrew
There's an iif statement that I'm struggling with on Reporting Services.
This statement is on a calulated field. The iif statement is as follows:
=iif(x=0, 0, ((y-z)/x)*100).
In other words, if x is zero then 0 must be the output. Else the above
formula must be the output. The syntax is perfect, and so is the logic (i
think...). When I run the report it gives me a warning message that it cannot
"divide by zero". What is obviously happening is that x is zero, but instead
of displaying zero (as it is instructed to do so), it's going straight to the
formula!
Can anyone please tell me what's happening, and how I can make it work?
Thanks in advance.
(By the way, this has to be in Reporting Services and not sql)
--
Regards,You might have some cases where x is null which would not be getting handled
in your expression. add another iif test to check for nulls
"crmLearner" <crmLearner@.discussions.microsoft.com> wrote in message
news:1F6784D8-CBD8-494A-81DB-098E9E922CB4@.microsoft.com...
> Hi there.
> There's an iif statement that I'm struggling with on Reporting Services.
> This statement is on a calulated field. The iif statement is as follows:
> =iif(x=0, 0, ((y-z)/x)*100).
> In other words, if x is zero then 0 must be the output. Else the above
> formula must be the output. The syntax is perfect, and so is the logic (i
> think...). When I run the report it gives me a warning message that it
> cannot
> "divide by zero". What is obviously happening is that x is zero, but
> instead
> of displaying zero (as it is instructed to do so), it's going straight to
> the
> formula!
> Can anyone please tell me what's happening, and how I can make it work?
> Thanks in advance.
> (By the way, this has to be in Reporting Services and not sql)
> --
> Regards,|||Wow, i can't believe i didn't think of that...i'll give it a try.
Thanks!
--
Regards,
"Dean" wrote:
> You might have some cases where x is null which would not be getting handled
> in your expression. add another iif test to check for nulls
> "crmLearner" <crmLearner@.discussions.microsoft.com> wrote in message
> news:1F6784D8-CBD8-494A-81DB-098E9E922CB4@.microsoft.com...
> > Hi there.
> >
> > There's an iif statement that I'm struggling with on Reporting Services.
> > This statement is on a calulated field. The iif statement is as follows:
> > =iif(x=0, 0, ((y-z)/x)*100).
> >
> > In other words, if x is zero then 0 must be the output. Else the above
> > formula must be the output. The syntax is perfect, and so is the logic (i
> > think...). When I run the report it gives me a warning message that it
> > cannot
> > "divide by zero". What is obviously happening is that x is zero, but
> > instead
> > of displaying zero (as it is instructed to do so), it's going straight to
> > the
> > formula!
> >
> > Can anyone please tell me what's happening, and how I can make it work?
> > Thanks in advance.
> >
> > (By the way, this has to be in Reporting Services and not sql)
> > --
> > Regards,
>
>|||another thing to check for is empty strings, depending on how the data was
entered there may be "spaces" in the fields which are not 0 nor are they
null.
"crmLearner" <crmLearner@.discussions.microsoft.com> wrote in message
news:55531FF7-63F6-44C5-9F31-83A2C32B5BFA@.microsoft.com...
> Wow, i can't believe i didn't think of that...i'll give it a try.
> Thanks!
> --
> Regards,
>
> "Dean" wrote:
>> You might have some cases where x is null which would not be getting
>> handled
>> in your expression. add another iif test to check for nulls
>> "crmLearner" <crmLearner@.discussions.microsoft.com> wrote in message
>> news:1F6784D8-CBD8-494A-81DB-098E9E922CB4@.microsoft.com...
>> > Hi there.
>> >
>> > There's an iif statement that I'm struggling with on Reporting
>> > Services.
>> > This statement is on a calulated field. The iif statement is as
>> > follows:
>> > =iif(x=0, 0, ((y-z)/x)*100).
>> >
>> > In other words, if x is zero then 0 must be the output. Else the above
>> > formula must be the output. The syntax is perfect, and so is the logic
>> > (i
>> > think...). When I run the report it gives me a warning message that it
>> > cannot
>> > "divide by zero". What is obviously happening is that x is zero, but
>> > instead
>> > of displaying zero (as it is instructed to do so), it's going straight
>> > to
>> > the
>> > formula!
>> >
>> > Can anyone please tell me what's happening, and how I can make it work?
>> > Thanks in advance.
>> >
>> > (By the way, this has to be in Reporting Services and not sql)
>> > --
>> > Regards,
>>|||The parameters to the IIF function are all evaluated in order to call the
function. So in your case the CLR calculates three values to be passed as
parameters...
(x=0)
,(0)
,((y-z)/x)*100)
...and would then have internal logic that says if the first parameter is
true return the second parameter else the third parameter. But that logic
won't get fired as your third parameter is giving a divided by zero exception
when x is zero.
You could write a code function to go in the Report Properties' Code tab...
Function SafeDividePercent (ByVal numerator As Integer, ByVal denominator As
Integer) As Object
If denominator = 0 Then
Return 0
Else
Return ( numerator / denominator) *100.0
End If
End Function
... and then use it like this for a text box's Expression.
=Code.SafeDividePercent( Fields!y.Value - Fields!z.Value, Fields!x.Value)
Note that I've assumed your variables are integers but that the result isn't.
Someone may have another way of dealing with it.
Hope that helps,
Andrew|||Please ignore my previous answer - it is completely and utterly WRONG!
You CAN safely use IIF() to prevent a divide by zero.
That'll teach me to try before I post.
Now, where did I put that hair shirt?
Sorry for any confusion,
Andrew
Subscribe to:
Posts (Atom)