Friday, February 24, 2012

IIF statement problem

Hello,
I'm having a problem with the iif statement. Seems that the conditional
never evaluates to true,
=iif(CountRows() = 0, "Detailed Report", Fields!Client_Name.value & "
Detailed Report")
Basically I'm checking if the recordcount is 0, if so - display "Detailed
Report", if not - then display "<Client Name> Detail Report"
Even though the CountRows value = 0, which I checked in a test textbox, it
still never displays "Detail Report" - it just comes up blank...any idea
what the problem is? thanksIf Fields collection is used in NoRows situation whole expression evaluates
to null (preview gives warning)
The workaround is:
Create textbox and set its value to
=Fields!Client_Name.Value
and make it hidden
When refer to that textbox instead of field:
=iif(CountRows() = 0, "Detailed Report", ReportItems!<textboxname>.Value & "
Detailed Report")
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"RS Developer" <idroppededabomb@.hotmail.com> wrote in message
news:%238g1U25gEHA.1652@.TK2MSFTNGP09.phx.gbl...
> Hello,
> I'm having a problem with the iif statement. Seems that the conditional
> never evaluates to true,
> =iif(CountRows() = 0, "Detailed Report", Fields!Client_Name.value & "
> Detailed Report")
> Basically I'm checking if the recordcount is 0, if so - display "Detailed
> Report", if not - then display "<Client Name> Detail Report"
> Even though the CountRows value = 0, which I checked in a test textbox, it
> still never displays "Detail Report" - it just comes up blank...any idea
> what the problem is? thanks
>|||That worked like a charm, thank you.
"Lev Semenets [MSFT]" <levs@.microsoft.com> wrote in message
news:eo1atc8gEHA.1656@.TK2MSFTNGP09.phx.gbl...
> If Fields collection is used in NoRows situation whole expression
evaluates
> to null (preview gives warning)
> The workaround is:
> Create textbox and set its value to
> =Fields!Client_Name.Value
> and make it hidden
> When refer to that textbox instead of field:
> =iif(CountRows() = 0, "Detailed Report", ReportItems!<textboxname>.Value &
"
> Detailed Report")
> --
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> "RS Developer" <idroppededabomb@.hotmail.com> wrote in message
> news:%238g1U25gEHA.1652@.TK2MSFTNGP09.phx.gbl...
> > Hello,
> >
> > I'm having a problem with the iif statement. Seems that the conditional
> > never evaluates to true,
> >
> > =iif(CountRows() = 0, "Detailed Report", Fields!Client_Name.value & "
> > Detailed Report")
> >
> > Basically I'm checking if the recordcount is 0, if so - display
"Detailed
> > Report", if not - then display "<Client Name> Detail Report"
> >
> > Even though the CountRows value = 0, which I checked in a test textbox,
it
> > still never displays "Detail Report" - it just comes up blank...any idea
> > what the problem is? thanks
> >
> >
>

No comments:

Post a Comment