Howdy,
IIS6 Win2003.
Set up the group on Node1. During testing I can down Node1 and groups
and resources failover to Node2. After Node1 comes back online, the
IIS Service Group failsback to Node1. Did I miss something?
TIA for any assistance.
Bill
Bill,
Have you set the failback policy for the group to failback immediately? The default is "prevent failback".
Additional Information:
=====================
To set group failback policy
Open Cluster Administrator.
In the console tree, click the Groups folder.
In the details pane, click the appropriate group.
On the File menu, click Properties.
On the Failback tab, click Prevent failback or Allow failback.
If you click Allow failback, then either click Immediately, or click Failback between and set the time interval.
Notes
To perform this procedure, you must be a member of the Administrators group on the local computer, or you must have been delegated the appropriate authority. If the computer is joined to a domain, members of
the Domain Admins group might be able to perform this procedure. As a security best practice, consider using Run as to perform this procedure.
To open Cluster Administrator, click Start, click Control Panel, double-click Administrative Tools, and then double-click Cluster Administrator.
To set the time interval for Failback between, enter numbers between 0 and 23 for the beginning and end of the interval. If the first number is greater than the second, the interval ends on the following day. The
numbers correspond to the local time of the cluster group, as read on a 24-hour clock.
It is important to set the failback time because you may not want failback to occur during hours of peak usage.
If no preferred owners are specified for the group, then failback does not occur.
Best Regards,
Uttam Parui
Microsoft Corporation
This posting is provided "AS IS" with no warranties, and confers no rights.
Are you secure? For information about the Strategic Technology Protection Program and to order your FREE Security Tool Kit, please visit http://www.microsoft.com/security.
Microsoft highly recommends that users with Internet access update their Microsoft software to better protect against viruses and security vulnerabilities. The easiest way to do this is to visit the following websites:
http://www.microsoft.com/protect
http://www.microsoft.com/security/guidance/default.mspx
|||Uttam,
I have the failback property set to 'Prevent failback'. Yet the IIS
Services Group continues to 'Failback' when the Node comes back online.
It does not seem to interfere with the functionality of IIS running from
the other Node though. While looking at the properties of this Group I
did notice a differnce in the failover threshold and period. On the
other two groups the I have the Threshold set to 10 and the period set
to 6 hrs. Would this have an effect?
Thanks again,
Bill
*** Sent via Developersdex http://www.codecomments.com ***
Don't just participate in USENET...get rewarded for it!
|||Bll,
Shutdown node 1 and verify that all resources come online on node 2.
If you don't want to shut down node 1 then move all resources to node 2 and pause node 1. make sure that all resources are coming online on node 2. If it fails then see the errors in NT logs and cluster.log and fix
them first.
You mentioned something about the difference in group properties? What is the difference that you saw ?
You wrote "On the other two groups the I have the Threshold set to 10 and the period set to 6 hrs. ". This is the default. What are the values on the IIS group? Did someone change it from the default?
Best Regards,
Uttam Parui
Microsoft Corporation
This posting is provided "AS IS" with no warranties, and confers no rights.
Are you secure? For information about the Strategic Technology Protection Program and to order your FREE Security Tool Kit, please visit http://www.microsoft.com/security.
Microsoft highly recommends that users with Internet access update their Microsoft software to better protect against viruses and security vulnerabilities. The easiest way to do this is to visit the following websites:
http://www.microsoft.com/protect
http://www.microsoft.com/security/guidance/default.mspx
|||Uttam,
If I down Node1, failover to Node2 works as designed no issues, when
Node1 comes back online, the IIS Services Group failsback to Node1.
There is no loss in functionality, IIS works as needed. It is just that
the Group fails back to the other Node.
I did Move the group to Node2 and it has stayed there, it is just during
failover from 1 to 2 that the anomialy occurs.
Settings were: Threshold 1, Period 2. I may have changed them some time
back (I fell off of testing for almost two months).
Thanks,
Bill
*** Sent via Developersdex http://www.codecomments.com ***
Don't just participate in USENET...get rewarded for it!
Showing posts with label prevent. Show all posts
Showing posts with label prevent. Show all posts
Friday, March 9, 2012
Friday, February 24, 2012
Iif statement to prevent divide by zero?
Hi- I'm trying to create a calculated field that is the percentage difference
between two database fields. To prevent a divide by zero, I tried making it:
= Iif( Fields!dsPrice.Value <> 0, (Fields!eePrice.Value -
Fields!dsPrice.Value) / Fields!dsPrice.Value, 1)
This should provide the % diff, or in the case that dsPrice is 0, 1 (100%).
When I try to run the report, however, it comes back as a divide by zero for
fields where dsPrice = 0. Does reporting services evaluate both portions of
the Iif, then output one? How do I avoid this divide by zero error?
Thanks in advance!
Peter L.iif always evaluates both sides. try using the short circuit operator
'andalso' or 'orelse' in a function and add it to the code and call it from
the expression.|||If the correct zero value is 100%, you can just move the pieces around like
this:
= Iif(Fields!dsPrice.Value = 0, 1, Fields!eePrice.Value ) /
Iif(Fields!eePrice.Value = 0, 1, Fields!dsPrice.Value)
That way, the division doesn't happen at all until the values are replaced.
--
Cheers,
'(' Jeff A. Stucker
\
Business Intelligence
www.criadvantage.com
---
"plandry@.newsgroups.nospam"
<plandrynewsgroupsnospam@.discussions.microsoft.com> wrote in message
news:4B6AE1CA-72DB-4DAE-8E63-147AF61BDC21@.microsoft.com...
> Hi- I'm trying to create a calculated field that is the percentage
> difference
> between two database fields. To prevent a divide by zero, I tried making
> it:
> = Iif( Fields!dsPrice.Value <> 0, (Fields!eePrice.Value -
> Fields!dsPrice.Value) / Fields!dsPrice.Value, 1)
> This should provide the % diff, or in the case that dsPrice is 0, 1
> (100%).
> When I try to run the report, however, it comes back as a divide by zero
> for
> fields where dsPrice = 0. Does reporting services evaluate both portions
> of
> the Iif, then output one? How do I avoid this divide by zero error?
> Thanks in advance!
> Peter L.|||Whoops, I think that should have been more like this:
= Iif(Fields!dsPrice.Value = 0, 1, Fields!eePrice.Value ) /
Iif(Fields!dsPrice.Value = 0, 1, Fields!dsPrice.Value)
Anyway, you get the idea!! :-)
--
Cheers,
'(' Jeff A. Stucker
\
Business Intelligence
www.criadvantage.com
---
"Jeff A. Stucker" <jeff@.mobilize.net> wrote in message
news:eGkBJLo8EHA.1264@.TK2MSFTNGP12.phx.gbl...
> If the correct zero value is 100%, you can just move the pieces around
> like this:
> = Iif(Fields!dsPrice.Value = 0, 1, Fields!eePrice.Value ) /
> Iif(Fields!eePrice.Value = 0, 1, Fields!dsPrice.Value)
> That way, the division doesn't happen at all until the values are
> replaced.
> --
> Cheers,
> '(' Jeff A. Stucker
> \
> Business Intelligence
> www.criadvantage.com
> ---
> "plandry@.newsgroups.nospam"
> <plandrynewsgroupsnospam@.discussions.microsoft.com> wrote in message
> news:4B6AE1CA-72DB-4DAE-8E63-147AF61BDC21@.microsoft.com...
>> Hi- I'm trying to create a calculated field that is the percentage
>> difference
>> between two database fields. To prevent a divide by zero, I tried making
>> it:
>> = Iif( Fields!dsPrice.Value <> 0, (Fields!eePrice.Value -
>> Fields!dsPrice.Value) / Fields!dsPrice.Value, 1)
>> This should provide the % diff, or in the case that dsPrice is 0, 1
>> (100%).
>> When I try to run the report, however, it comes back as a divide by zero
>> for
>> fields where dsPrice = 0. Does reporting services evaluate both portions
>> of
>> the Iif, then output one? How do I avoid this divide by zero error?
>> Thanks in advance!
>> Peter L.
>|||That did the trick... Thanks a bunch!
I will file that away in the "ninja reporting tricks" :)
"Jeff A. Stucker" wrote:
> Whoops, I think that should have been more like this:
> = Iif(Fields!dsPrice.Value = 0, 1, Fields!eePrice.Value ) /
> Iif(Fields!dsPrice.Value = 0, 1, Fields!dsPrice.Value)
> Anyway, you get the idea!! :-)
> --
> Cheers,
> '(' Jeff A. Stucker
> \
> Business Intelligence
> www.criadvantage.com
> ---
> "Jeff A. Stucker" <jeff@.mobilize.net> wrote in message
> news:eGkBJLo8EHA.1264@.TK2MSFTNGP12.phx.gbl...
> > If the correct zero value is 100%, you can just move the pieces around
> > like this:
> >
> > = Iif(Fields!dsPrice.Value = 0, 1, Fields!eePrice.Value ) /
> > Iif(Fields!eePrice.Value = 0, 1, Fields!dsPrice.Value)
> >
> > That way, the division doesn't happen at all until the values are
> > replaced.
> >
> > --
> > Cheers,
> >
> > '(' Jeff A. Stucker
> > \
> >
> > Business Intelligence
> > www.criadvantage.com
> > ---
> > "plandry@.newsgroups.nospam"
> > <plandrynewsgroupsnospam@.discussions.microsoft.com> wrote in message
> > news:4B6AE1CA-72DB-4DAE-8E63-147AF61BDC21@.microsoft.com...
> >> Hi- I'm trying to create a calculated field that is the percentage
> >> difference
> >> between two database fields. To prevent a divide by zero, I tried making
> >> it:
> >> = Iif( Fields!dsPrice.Value <> 0, (Fields!eePrice.Value -
> >> Fields!dsPrice.Value) / Fields!dsPrice.Value, 1)
> >> This should provide the % diff, or in the case that dsPrice is 0, 1
> >> (100%).
> >> When I try to run the report, however, it comes back as a divide by zero
> >> for
> >> fields where dsPrice = 0. Does reporting services evaluate both portions
> >> of
> >> the Iif, then output one? How do I avoid this divide by zero error?
> >>
> >> Thanks in advance!
> >> Peter L.
> >
> >
>
>
between two database fields. To prevent a divide by zero, I tried making it:
= Iif( Fields!dsPrice.Value <> 0, (Fields!eePrice.Value -
Fields!dsPrice.Value) / Fields!dsPrice.Value, 1)
This should provide the % diff, or in the case that dsPrice is 0, 1 (100%).
When I try to run the report, however, it comes back as a divide by zero for
fields where dsPrice = 0. Does reporting services evaluate both portions of
the Iif, then output one? How do I avoid this divide by zero error?
Thanks in advance!
Peter L.iif always evaluates both sides. try using the short circuit operator
'andalso' or 'orelse' in a function and add it to the code and call it from
the expression.|||If the correct zero value is 100%, you can just move the pieces around like
this:
= Iif(Fields!dsPrice.Value = 0, 1, Fields!eePrice.Value ) /
Iif(Fields!eePrice.Value = 0, 1, Fields!dsPrice.Value)
That way, the division doesn't happen at all until the values are replaced.
--
Cheers,
'(' Jeff A. Stucker
\
Business Intelligence
www.criadvantage.com
---
"plandry@.newsgroups.nospam"
<plandrynewsgroupsnospam@.discussions.microsoft.com> wrote in message
news:4B6AE1CA-72DB-4DAE-8E63-147AF61BDC21@.microsoft.com...
> Hi- I'm trying to create a calculated field that is the percentage
> difference
> between two database fields. To prevent a divide by zero, I tried making
> it:
> = Iif( Fields!dsPrice.Value <> 0, (Fields!eePrice.Value -
> Fields!dsPrice.Value) / Fields!dsPrice.Value, 1)
> This should provide the % diff, or in the case that dsPrice is 0, 1
> (100%).
> When I try to run the report, however, it comes back as a divide by zero
> for
> fields where dsPrice = 0. Does reporting services evaluate both portions
> of
> the Iif, then output one? How do I avoid this divide by zero error?
> Thanks in advance!
> Peter L.|||Whoops, I think that should have been more like this:
= Iif(Fields!dsPrice.Value = 0, 1, Fields!eePrice.Value ) /
Iif(Fields!dsPrice.Value = 0, 1, Fields!dsPrice.Value)
Anyway, you get the idea!! :-)
--
Cheers,
'(' Jeff A. Stucker
\
Business Intelligence
www.criadvantage.com
---
"Jeff A. Stucker" <jeff@.mobilize.net> wrote in message
news:eGkBJLo8EHA.1264@.TK2MSFTNGP12.phx.gbl...
> If the correct zero value is 100%, you can just move the pieces around
> like this:
> = Iif(Fields!dsPrice.Value = 0, 1, Fields!eePrice.Value ) /
> Iif(Fields!eePrice.Value = 0, 1, Fields!dsPrice.Value)
> That way, the division doesn't happen at all until the values are
> replaced.
> --
> Cheers,
> '(' Jeff A. Stucker
> \
> Business Intelligence
> www.criadvantage.com
> ---
> "plandry@.newsgroups.nospam"
> <plandrynewsgroupsnospam@.discussions.microsoft.com> wrote in message
> news:4B6AE1CA-72DB-4DAE-8E63-147AF61BDC21@.microsoft.com...
>> Hi- I'm trying to create a calculated field that is the percentage
>> difference
>> between two database fields. To prevent a divide by zero, I tried making
>> it:
>> = Iif( Fields!dsPrice.Value <> 0, (Fields!eePrice.Value -
>> Fields!dsPrice.Value) / Fields!dsPrice.Value, 1)
>> This should provide the % diff, or in the case that dsPrice is 0, 1
>> (100%).
>> When I try to run the report, however, it comes back as a divide by zero
>> for
>> fields where dsPrice = 0. Does reporting services evaluate both portions
>> of
>> the Iif, then output one? How do I avoid this divide by zero error?
>> Thanks in advance!
>> Peter L.
>|||That did the trick... Thanks a bunch!
I will file that away in the "ninja reporting tricks" :)
"Jeff A. Stucker" wrote:
> Whoops, I think that should have been more like this:
> = Iif(Fields!dsPrice.Value = 0, 1, Fields!eePrice.Value ) /
> Iif(Fields!dsPrice.Value = 0, 1, Fields!dsPrice.Value)
> Anyway, you get the idea!! :-)
> --
> Cheers,
> '(' Jeff A. Stucker
> \
> Business Intelligence
> www.criadvantage.com
> ---
> "Jeff A. Stucker" <jeff@.mobilize.net> wrote in message
> news:eGkBJLo8EHA.1264@.TK2MSFTNGP12.phx.gbl...
> > If the correct zero value is 100%, you can just move the pieces around
> > like this:
> >
> > = Iif(Fields!dsPrice.Value = 0, 1, Fields!eePrice.Value ) /
> > Iif(Fields!eePrice.Value = 0, 1, Fields!dsPrice.Value)
> >
> > That way, the division doesn't happen at all until the values are
> > replaced.
> >
> > --
> > Cheers,
> >
> > '(' Jeff A. Stucker
> > \
> >
> > Business Intelligence
> > www.criadvantage.com
> > ---
> > "plandry@.newsgroups.nospam"
> > <plandrynewsgroupsnospam@.discussions.microsoft.com> wrote in message
> > news:4B6AE1CA-72DB-4DAE-8E63-147AF61BDC21@.microsoft.com...
> >> Hi- I'm trying to create a calculated field that is the percentage
> >> difference
> >> between two database fields. To prevent a divide by zero, I tried making
> >> it:
> >> = Iif( Fields!dsPrice.Value <> 0, (Fields!eePrice.Value -
> >> Fields!dsPrice.Value) / Fields!dsPrice.Value, 1)
> >> This should provide the % diff, or in the case that dsPrice is 0, 1
> >> (100%).
> >> When I try to run the report, however, it comes back as a divide by zero
> >> for
> >> fields where dsPrice = 0. Does reporting services evaluate both portions
> >> of
> >> the Iif, then output one? How do I avoid this divide by zero error?
> >>
> >> Thanks in advance!
> >> Peter L.
> >
> >
>
>
Sunday, February 19, 2012
IIF Grrrr
I'm using an IIF statement to prevent the #Error when my formula is trying to divide by zero. IIF(FieldA=0,0,FieldB/FieldA).
It is still giving me an #Error for the fields where denominator is zero--works great for all the others, but that defeats the purpose of the IIF.
I've tried sanity checks where I have even changed it to IIF(FieldA=0,0,"NO") or IIF(FieldA=0,0,20/0) and it knows to put a zero then.
I know I have used this successfully elsewhere--only difference that is new to me is that FieldA is a ReportItems field and FieldB is a sum(Fields!). Don't know if that matters--rather than lose my sanity on a Monday I thought I would see if this is a good forum for my crazy questions.
Thanks in advance!
From http://www.developmentnow.com/g/115_2007_4_0_0_0/sql-server-reporting-services.ht
Posted via DevelopmentNow.com Group
http://www.developmentnow.comElle,
I usually like to put a function in the Report level (Report
properties-->Code tab) code to handle divide by zero. It looks something
like this:
Public Function CalcAvg(dblNum As Double, dblDen As Double) as Object
if (dblDen = nothing) or (dblDen = 0)
CalcAvg = 0
else
CalcAvg = dblNum / dblDen
end if
End Function
From within my report, I call it like this
=Code.CalcAvg(Fields!field1.value, Fields!field2.value)
Hope this helps
--
Andy Potter
blog : http://sqlreportingservices.spaces.live.com
info@.(NOSPAM)lakeclaireenterprises.com
"Elle" <nospam@.developmentnow.com> wrote in message
news:967b2d74-9c26-4a85-bd01-45c75dbfdb82@.developmentnow.com...
> I'm using an IIF statement to prevent the #Error when my formula is trying
> to divide by zero. IIF(FieldA=0,0,FieldB/FieldA).
> It is still giving me an #Error for the fields where denominator is
> zero--works great for all the others, but that defeats the purpose of the
> IIF.
> I've tried sanity checks where I have even changed it to
> IIF(FieldA=0,0,"NO") or IIF(FieldA=0,0,20/0) and it knows to put a zero
> then.
> I know I have used this successfully elsewhere--only difference that is
> new to me is that FieldA is a ReportItems field and FieldB is a
> sum(Fields!). Don't know if that matters--rather than lose my sanity on a
> Monday I thought I would see if this is a good forum for my crazy
> questions.
> Thanks in advance!
> From
> http://www.developmentnow.com/g/115_2007_4_0_0_0/sql-server-reporting-services.htm
> Posted via DevelopmentNow.com Groups
> http://www.developmentnow.com|||Thanks Andy. Somehow I thought it would be more straightforward this way but it is probably something I should be doing at the report level. I'll give it a try. Do you happen to know if one way can be touted as more efficient than the other? Is the function streamlining the whole process a little better too? Just curious.
Thanks,
ELL
From http://www.developmentnow.com/groups/viewthread.aspx?newsgroupid=115&threadid=95299
Posted via DevelopmentNow.com Group
http://www.developmentnow.com|||From a pure maintenance/debugging standpoint, it is far more efficient. From
a performance standpoint I don't know of any significant difference.
What I really like to do is put functions like this in an assembly and then
simply refer to the assembly in all my reports. That gives me the full .NET
language (VB.NET or C#) and lots of code reuse across multiple reports for
common functions like this.
--
Andy Potter
blog : http://sqlreportingservices.spaces.live.com
info@.(NOSPAM)lakeclaireenterprises.com
"Elle" <nospam@.developmentnow.com> wrote in message
news:5132d019-b8ad-4444-937c-0b7335ee7515@.developmentnow.com...
> Thanks Andy. Somehow I thought it would be more straightforward this way
> but it is probably something I should be doing at the report level. I'll
> give it a try. Do you happen to know if one way can be touted as more
> efficient than the other? Is the function streamlining the whole process
> a little better too? Just curious.
> Thanks,
> ELLE
> From
> http://www.developmentnow.com/groups/viewthread.aspx?newsgroupid=115&threadid=952992
> Posted via DevelopmentNow.com Groups
> http://www.developmentnow.com|||On Apr 2, 5:59 pm, Elle<nos...@.developmentnow.com> wrote:
> I'm using an IIF statement to prevent the #Error when my formula is trying to divide by zero. IIF(FieldA=0,0,FieldB/FieldA).
> It is still giving me an #Error for the fields where denominator is zero--works great for all the others, but that defeats the purpose of the IIF.
> I've tried sanity checks where I have even changed it to IIF(FieldA=0,0,"NO") or IIF(FieldA=0,0,20/0) and it knows to put a zero then.
> I know I have used this successfully elsewhere--only difference that is new to me is that FieldA is a ReportItems field and FieldB is a sum(Fields!). Don't know if that matters--rather than lose my sanity on a Monday I thought I would see if this is a good forum for my crazy questions.
> Thanks in advance!
> Fromhttp://www.developmentnow.com/g/115_2007_4_0_0_0/sql-server-reporting...
> Posted via DevelopmentNow.com Groupshttp://www.developmentnow.com
Hi Elle/All,
when I studied RS in great detail to see how I could get the best out
of it I determined that (in my opinion) as much processing and
calculation as possible should be placed into a custom assembly and
called....although this adds a little to run time the centralisation
of all code into one place that can be called by all reports seems
very much worth it...now we are a year down the track I feel this
choice has been validated many times over and we have put vast amounts
of code into the custom assembly and all but eliminated any code
inside a report....
Just my 2 cents worth!
Best Regards
Peter
www.peternolan.com|||All the MS environments I've worked with require an IIF statement to evaluate
the entire statement before evaluating the "IF clause", rather than
evaluating the "IF clause" and proceding to the relevant branch. So, in the
case of the "divide by zero" example, the IIF statement still has to attempt
to perform the FieldB/FieldA calculation in order to process the IIF
statement, rather than evaluating whether or not FieldA is > 0 and proceding
to the first branch rather than the second. Andy's suggested code has the
great advantage of skipping the divide-by-zero branch altogether.
"Elle" wrote:
> I'm using an IIF statement to prevent the #Error when my formula is trying to divide by zero. IIF(FieldA=0,0,FieldB/FieldA).
> It is still giving me an #Error for the fields where denominator is zero--works great for all the others, but that defeats the purpose of the IIF.
> I've tried sanity checks where I have even changed it to IIF(FieldA=0,0,"NO") or IIF(FieldA=0,0,20/0) and it knows to put a zero then.
> I know I have used this successfully elsewhere--only difference that is new to me is that FieldA is a ReportItems field and FieldB is a sum(Fields!). Don't know if that matters--rather than lose my sanity on a Monday I thought I would see if this is a good forum for my crazy questions.
> Thanks in advance!
> From http://www.developmentnow.com/g/115_2007_4_0_0_0/sql-server-reporting-services.htm
> Posted via DevelopmentNow.com Groups
> http://www.developmentnow.com
>|||Just to advise, the reason for the problem is the when IIF is
evaluated, BOTH the 'true part' and the 'false part' are always
evaluated - so either part can cause such an error, even if (in a
particular case) it is not the part that would be returned.|||On Apr 4, 9:05 am, "Parker" <psm...@.iquest.net> wrote:
> Just to advise, the reason for the problem is the when IIF is
> evaluated, BOTH the 'true part' and the 'false part' are always
> evaluated - so either part can cause such an error, even if (in a
> particular case) it is not the part that would be returned.
For this particular case, the following should work without error:
IIF(FieldA=0, 0, FieldB / IIF(FieldA=0, 1, FieldA))
If FieldA is 0, the 'false part' will evaluate to FieldB/1 instead of
FieldB/0 which was causing the error.|||Thanks all. Very very helpful forum.
ELLE
From http://www.developmentnow.com/groups/viewthread.aspx?newsgroupid=115&threadid=95299
Posted via DevelopmentNow.com Group
http://www.developmentnow.com
It is still giving me an #Error for the fields where denominator is zero--works great for all the others, but that defeats the purpose of the IIF.
I've tried sanity checks where I have even changed it to IIF(FieldA=0,0,"NO") or IIF(FieldA=0,0,20/0) and it knows to put a zero then.
I know I have used this successfully elsewhere--only difference that is new to me is that FieldA is a ReportItems field and FieldB is a sum(Fields!). Don't know if that matters--rather than lose my sanity on a Monday I thought I would see if this is a good forum for my crazy questions.
Thanks in advance!
From http://www.developmentnow.com/g/115_2007_4_0_0_0/sql-server-reporting-services.ht
Posted via DevelopmentNow.com Group
http://www.developmentnow.comElle,
I usually like to put a function in the Report level (Report
properties-->Code tab) code to handle divide by zero. It looks something
like this:
Public Function CalcAvg(dblNum As Double, dblDen As Double) as Object
if (dblDen = nothing) or (dblDen = 0)
CalcAvg = 0
else
CalcAvg = dblNum / dblDen
end if
End Function
From within my report, I call it like this
=Code.CalcAvg(Fields!field1.value, Fields!field2.value)
Hope this helps
--
Andy Potter
blog : http://sqlreportingservices.spaces.live.com
info@.(NOSPAM)lakeclaireenterprises.com
"Elle" <nospam@.developmentnow.com> wrote in message
news:967b2d74-9c26-4a85-bd01-45c75dbfdb82@.developmentnow.com...
> I'm using an IIF statement to prevent the #Error when my formula is trying
> to divide by zero. IIF(FieldA=0,0,FieldB/FieldA).
> It is still giving me an #Error for the fields where denominator is
> zero--works great for all the others, but that defeats the purpose of the
> IIF.
> I've tried sanity checks where I have even changed it to
> IIF(FieldA=0,0,"NO") or IIF(FieldA=0,0,20/0) and it knows to put a zero
> then.
> I know I have used this successfully elsewhere--only difference that is
> new to me is that FieldA is a ReportItems field and FieldB is a
> sum(Fields!). Don't know if that matters--rather than lose my sanity on a
> Monday I thought I would see if this is a good forum for my crazy
> questions.
> Thanks in advance!
> From
> http://www.developmentnow.com/g/115_2007_4_0_0_0/sql-server-reporting-services.htm
> Posted via DevelopmentNow.com Groups
> http://www.developmentnow.com|||Thanks Andy. Somehow I thought it would be more straightforward this way but it is probably something I should be doing at the report level. I'll give it a try. Do you happen to know if one way can be touted as more efficient than the other? Is the function streamlining the whole process a little better too? Just curious.
Thanks,
ELL
From http://www.developmentnow.com/groups/viewthread.aspx?newsgroupid=115&threadid=95299
Posted via DevelopmentNow.com Group
http://www.developmentnow.com|||From a pure maintenance/debugging standpoint, it is far more efficient. From
a performance standpoint I don't know of any significant difference.
What I really like to do is put functions like this in an assembly and then
simply refer to the assembly in all my reports. That gives me the full .NET
language (VB.NET or C#) and lots of code reuse across multiple reports for
common functions like this.
--
Andy Potter
blog : http://sqlreportingservices.spaces.live.com
info@.(NOSPAM)lakeclaireenterprises.com
"Elle" <nospam@.developmentnow.com> wrote in message
news:5132d019-b8ad-4444-937c-0b7335ee7515@.developmentnow.com...
> Thanks Andy. Somehow I thought it would be more straightforward this way
> but it is probably something I should be doing at the report level. I'll
> give it a try. Do you happen to know if one way can be touted as more
> efficient than the other? Is the function streamlining the whole process
> a little better too? Just curious.
> Thanks,
> ELLE
> From
> http://www.developmentnow.com/groups/viewthread.aspx?newsgroupid=115&threadid=952992
> Posted via DevelopmentNow.com Groups
> http://www.developmentnow.com|||On Apr 2, 5:59 pm, Elle<nos...@.developmentnow.com> wrote:
> I'm using an IIF statement to prevent the #Error when my formula is trying to divide by zero. IIF(FieldA=0,0,FieldB/FieldA).
> It is still giving me an #Error for the fields where denominator is zero--works great for all the others, but that defeats the purpose of the IIF.
> I've tried sanity checks where I have even changed it to IIF(FieldA=0,0,"NO") or IIF(FieldA=0,0,20/0) and it knows to put a zero then.
> I know I have used this successfully elsewhere--only difference that is new to me is that FieldA is a ReportItems field and FieldB is a sum(Fields!). Don't know if that matters--rather than lose my sanity on a Monday I thought I would see if this is a good forum for my crazy questions.
> Thanks in advance!
> Fromhttp://www.developmentnow.com/g/115_2007_4_0_0_0/sql-server-reporting...
> Posted via DevelopmentNow.com Groupshttp://www.developmentnow.com
Hi Elle/All,
when I studied RS in great detail to see how I could get the best out
of it I determined that (in my opinion) as much processing and
calculation as possible should be placed into a custom assembly and
called....although this adds a little to run time the centralisation
of all code into one place that can be called by all reports seems
very much worth it...now we are a year down the track I feel this
choice has been validated many times over and we have put vast amounts
of code into the custom assembly and all but eliminated any code
inside a report....
Just my 2 cents worth!
Best Regards
Peter
www.peternolan.com|||All the MS environments I've worked with require an IIF statement to evaluate
the entire statement before evaluating the "IF clause", rather than
evaluating the "IF clause" and proceding to the relevant branch. So, in the
case of the "divide by zero" example, the IIF statement still has to attempt
to perform the FieldB/FieldA calculation in order to process the IIF
statement, rather than evaluating whether or not FieldA is > 0 and proceding
to the first branch rather than the second. Andy's suggested code has the
great advantage of skipping the divide-by-zero branch altogether.
"Elle" wrote:
> I'm using an IIF statement to prevent the #Error when my formula is trying to divide by zero. IIF(FieldA=0,0,FieldB/FieldA).
> It is still giving me an #Error for the fields where denominator is zero--works great for all the others, but that defeats the purpose of the IIF.
> I've tried sanity checks where I have even changed it to IIF(FieldA=0,0,"NO") or IIF(FieldA=0,0,20/0) and it knows to put a zero then.
> I know I have used this successfully elsewhere--only difference that is new to me is that FieldA is a ReportItems field and FieldB is a sum(Fields!). Don't know if that matters--rather than lose my sanity on a Monday I thought I would see if this is a good forum for my crazy questions.
> Thanks in advance!
> From http://www.developmentnow.com/g/115_2007_4_0_0_0/sql-server-reporting-services.htm
> Posted via DevelopmentNow.com Groups
> http://www.developmentnow.com
>|||Just to advise, the reason for the problem is the when IIF is
evaluated, BOTH the 'true part' and the 'false part' are always
evaluated - so either part can cause such an error, even if (in a
particular case) it is not the part that would be returned.|||On Apr 4, 9:05 am, "Parker" <psm...@.iquest.net> wrote:
> Just to advise, the reason for the problem is the when IIF is
> evaluated, BOTH the 'true part' and the 'false part' are always
> evaluated - so either part can cause such an error, even if (in a
> particular case) it is not the part that would be returned.
For this particular case, the following should work without error:
IIF(FieldA=0, 0, FieldB / IIF(FieldA=0, 1, FieldA))
If FieldA is 0, the 'false part' will evaluate to FieldB/1 instead of
FieldB/0 which was causing the error.|||Thanks all. Very very helpful forum.
ELLE
From http://www.developmentnow.com/groups/viewthread.aspx?newsgroupid=115&threadid=95299
Posted via DevelopmentNow.com Group
http://www.developmentnow.com
Subscribe to:
Posts (Atom)