Hi. I have another problem. Anyone please? Your answers will be greatly appreciated. My code is like this :
=iif(Fields!TDeact.Value = 0, "N/A",Fields!TDeactn.Value/Fields!TDeact.Value)
- this code is to eliminate the problem: "attempted to divide by zero";
however, it does not work. Still there's an error showing in my report, instead of the "N/A" i set in my code, it shows "#Error".
Anyone please, i have a deadline to meet for the realse of our project we're doing right now. Thanks.I think the issue is trying to have 2 separate data types to be displayed in
the same cell. You may try to change "N/A" to some other representation...
NaN etc...
"tulips_2812" wrote:
> Hi. I have another problem. Anyone please? Your answers will be greatly
> appreciated. My code is like this :
> =iif(Fields!TDeact.Value = 0, "N/A",
> Fields!TDeactn.Value/Fields!TDeact.Value)
> - this code is to eliminate the problem: "attempted to divide by zero";
> however, it does not work. Still there's an error showing in my report,
> instead of the "N/A" i set in my code, it shows "#Error".
> Anyone please, i have a deadline to meet for the realse of our project
> we're doing right now. Thanks.
>|||Try using 0, iif(deact.value = 0,0,deact.value)
--
U. Tokklas
"mike" wrote:
> I think the issue is trying to have 2 separate data types to be displayed in
> the same cell. You may try to change "N/A" to some other representation...
> NaN etc...
> "tulips_2812" wrote:
> > Hi. I have another problem. Anyone please? Your answers will be greatly
> > appreciated. My code is like this :
> >
> > =iif(Fields!TDeact.Value = 0, "N/A",
> > Fields!TDeactn.Value/Fields!TDeact.Value)
> >
> > - this code is to eliminate the problem: "attempted to divide by zero";
> > however, it does not work. Still there's an error showing in my report,
> > instead of the "N/A" i set in my code, it shows "#Error".
> >
> > Anyone please, i have a deadline to meet for the realse of our project
> > we're doing right now. Thanks.
> >
> >|||All parts of the IIF statement are evaluated, whether true or false.
You could write a code block to handle your problem. Search writing custom
code in the help.
=Code.Divide(Fields!TDeactn.Value,Fields!TDeact.Value)
Function Divide (byval nom as integer, byval denom as integer)
if denom > 0 then
return nom/denom
else
return "n/a"
end if
"Tokklas" wrote:
> Try using 0, iif(deact.value = 0,0,deact.value)
> --
> U. Tokklas
>
> "mike" wrote:
> > I think the issue is trying to have 2 separate data types to be displayed in
> > the same cell. You may try to change "N/A" to some other representation...
> > NaN etc...
> >
> > "tulips_2812" wrote:
> >
> > > Hi. I have another problem. Anyone please? Your answers will be greatly
> > > appreciated. My code is like this :
> > >
> > > =iif(Fields!TDeact.Value = 0, "N/A",
> > > Fields!TDeactn.Value/Fields!TDeact.Value)
> > >
> > > - this code is to eliminate the problem: "attempted to divide by zero";
> > > however, it does not work. Still there's an error showing in my report,
> > > instead of the "N/A" i set in my code, it shows "#Error".
> > >
> > > Anyone please, i have a deadline to meet for the realse of our project
> > > we're doing right now. Thanks.
> > >
> > >|||I wrote a piece of code:
Function DivideByZero(sValue1 as Object, sValue2 as Object)
If (sValue1 <> 0 AND sValue2 = 0) OR (sValue1 = 0 AND sValue2 <> 0) then
Return "NA"
Elseif sValue1 = 0 AND sValue2 = 0 then
Return "NA"
Else
Return (sValue1 - sValue2) / sValue2
End If
End Function
"tulips_2812" wrote:
> Hi. I have another problem. Anyone please? Your answers will be greatly
> appreciated. My code is like this :
> =iif(Fields!TDeact.Value = 0, "N/A",
> Fields!TDeactn.Value/Fields!TDeact.Value)
> - this code is to eliminate the problem: "attempted to divide by zero";
> however, it does not work. Still there's an error showing in my report,
> instead of the "N/A" i set in my code, it shows "#Error".
> Anyone please, i have a deadline to meet for the realse of our project
> we're doing right now. Thanks.
>|||Hello Harolds,
You're code was so fantastic. thank you very much. It really, really
helped..i just added End Function in the last part :)
Regards,
Althea|||I wrote a similar code. But I can not use this code in footer for calculate
sum.
Anyone solve this problem?
"Kerry" wrote:
> I wrote a piece of code:
> Function DivideByZero(sValue1 as Object, sValue2 as Object)
> If (sValue1 <> 0 AND sValue2 = 0) OR (sValue1 = 0 AND sValue2 <> 0) then
> Return "NA"
> Elseif sValue1 = 0 AND sValue2 = 0 then
> Return "NA"
> Else
> Return (sValue1 - sValue2) / sValue2
> End If
> End Function
> "tulips_2812" wrote:
> > Hi. I have another problem. Anyone please? Your answers will be greatly
> > appreciated. My code is like this :
> >
> > =iif(Fields!TDeact.Value = 0, "N/A",
> > Fields!TDeactn.Value/Fields!TDeact.Value)
> >
> > - this code is to eliminate the problem: "attempted to divide by zero";
> > however, it does not work. Still there's an error showing in my report,
> > instead of the "N/A" i set in my code, it shows "#Error".
> >
> > Anyone please, i have a deadline to meet for the realse of our project
> > we're doing right now. Thanks.
> >
> >|||Page header and footer have no access to the Fields collection.
You can have a textbox (may be hidden/invisible on a page and then aggregate
value of the textbox in page header/footer (Sum(ReportItems!mytextbox.Value)
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Savage" <Savage@.discussions.microsoft.com> wrote in message
news:14E1E6DB-7F3A-41A0-B415-4598BB8DF480@.microsoft.com...
>I wrote a similar code. But I can not use this code in footer for calculate
> sum.
> Anyone solve this problem?
> "Kerry" wrote:
>> I wrote a piece of code:
>> Function DivideByZero(sValue1 as Object, sValue2 as Object)
>> If (sValue1 <> 0 AND sValue2 = 0) OR (sValue1 = 0 AND sValue2 <> 0)
>> then
>> Return "NA"
>> Elseif sValue1 = 0 AND sValue2 = 0 then
>> Return "NA"
>> Else
>> Return (sValue1 - sValue2) / sValue2
>> End If
>> End Function
>> "tulips_2812" wrote:
>> > Hi. I have another problem. Anyone please? Your answers will be greatly
>> > appreciated. My code is like this :
>> >
>> > =iif(Fields!TDeact.Value = 0, "N/A",
>> > Fields!TDeactn.Value/Fields!TDeact.Value)
>> >
>> > - this code is to eliminate the problem: "attempted to divide by zero";
>> > however, it does not work. Still there's an error showing in my report,
>> > instead of the "N/A" i set in my code, it shows "#Error".
>> >
>> > Anyone please, i have a deadline to meet for the realse of our project
>> > we're doing right now. Thanks.
>> >
>> >|||I was talking about Table footer.
"Alexandre Mineev MSFT" wrote:
> Page header and footer have no access to the Fields collection.
> You can have a textbox (may be hidden/invisible on a page and then aggregate
> value of the textbox in page header/footer (Sum(ReportItems!mytextbox.Value)
> --
> This posting is provided "AS IS" with no warranties, and confers no rights.
> "Savage" <Savage@.discussions.microsoft.com> wrote in message
> news:14E1E6DB-7F3A-41A0-B415-4598BB8DF480@.microsoft.com...
> >I wrote a similar code. But I can not use this code in footer for calculate
> > sum.
> > Anyone solve this problem?
> >
> > "Kerry" wrote:
> >
> >> I wrote a piece of code:
> >>
> >> Function DivideByZero(sValue1 as Object, sValue2 as Object)
> >>
> >> If (sValue1 <> 0 AND sValue2 = 0) OR (sValue1 = 0 AND sValue2 <> 0)
> >> then
> >> Return "NA"
> >> Elseif sValue1 = 0 AND sValue2 = 0 then
> >> Return "NA"
> >> Else
> >> Return (sValue1 - sValue2) / sValue2
> >> End If
> >> End Function
> >>
> >> "tulips_2812" wrote:
> >>
> >> > Hi. I have another problem. Anyone please? Your answers will be greatly
> >> > appreciated. My code is like this :
> >> >
> >> > =iif(Fields!TDeact.Value = 0, "N/A",
> >> > Fields!TDeactn.Value/Fields!TDeact.Value)
> >> >
> >> > - this code is to eliminate the problem: "attempted to divide by zero";
> >> > however, it does not work. Still there's an error showing in my report,
> >> > instead of the "N/A" i set in my code, it shows "#Error".
> >> >
> >> > Anyone please, i have a deadline to meet for the realse of our project
> >> > we're doing right now. Thanks.
> >> >
> >> >
>
>|||The function DivideByZero should be Public and you should call it as
=Code.DivideByZero(x,y)
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Savage" <Savage@.discussions.microsoft.com> wrote in message
news:0EDDB40E-B10B-4D0C-9543-E4C07A984BB1@.microsoft.com...
>I was talking about Table footer.
>
> "Alexandre Mineev MSFT" wrote:
>> Page header and footer have no access to the Fields collection.
>> You can have a textbox (may be hidden/invisible on a page and then
>> aggregate
>> value of the textbox in page header/footer
>> (Sum(ReportItems!mytextbox.Value)
>> --
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>> "Savage" <Savage@.discussions.microsoft.com> wrote in message
>> news:14E1E6DB-7F3A-41A0-B415-4598BB8DF480@.microsoft.com...
>> >I wrote a similar code. But I can not use this code in footer for
>> >calculate
>> > sum.
>> > Anyone solve this problem?
>> >
>> > "Kerry" wrote:
>> >
>> >> I wrote a piece of code:
>> >>
>> >> Function DivideByZero(sValue1 as Object, sValue2 as Object)
>> >>
>> >> If (sValue1 <> 0 AND sValue2 = 0) OR (sValue1 = 0 AND sValue2 <> 0)
>> >> then
>> >> Return "NA"
>> >> Elseif sValue1 = 0 AND sValue2 = 0 then
>> >> Return "NA"
>> >> Else
>> >> Return (sValue1 - sValue2) / sValue2
>> >> End If
>> >> End Function
>> >>
>> >> "tulips_2812" wrote:
>> >>
>> >> > Hi. I have another problem. Anyone please? Your answers will be
>> >> > greatly
>> >> > appreciated. My code is like this :
>> >> >
>> >> > =iif(Fields!TDeact.Value = 0, "N/A",
>> >> > Fields!TDeactn.Value/Fields!TDeact.Value)
>> >> >
>> >> > - this code is to eliminate the problem: "attempted to divide by
>> >> > zero";
>> >> > however, it does not work. Still there's an error showing in my
>> >> > report,
>> >> > instead of the "N/A" i set in my code, it shows "#Error".
>> >> >
>> >> > Anyone please, i have a deadline to meet for the realse of our
>> >> > project
>> >> > we're doing right now. Thanks.
>> >> >
>> >> >
>>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment