0

I need to check the equality of two strings in rdl <code> file.

The below condition check only both or in Null values. but i need to check the parameter values are equal or not.

The below functions is custom function written in <code></code> block. Please help.

NPServedasperPolicy and NPServed parameter values are coming from reports values.

   public function getNoticePeriodStatus
        (byval NPServed as String,byval NPServedasperPolicy as String)


        if(NPServedasperPolicy = NPServed)
                getNoticePeriodStatus = "Notice period Fully Served"
        end if
Sébastien Sevrin
  • 5,267
  • 2
  • 22
  • 39
Murugan
  • 33
  • 8

1 Answers1

0

Assuming you want to display:

  • "Notice period Not Served" if NPServedasperPolicy and NPServed are different or both null
  • "Notice period Fully Served" if NPServedasperPolicy and NPServed are equal

You could use the following custom code:

Public Function GetNoticePeriodStatus (ByVal NPServed as String,ByVal NPServedasperPolicy as String)
        If((Not(NPServedasperPolicy Is Nothing) And Not(NPServed Is Nothing)) and NPServedasperPolicy = NPServed) Then
                GetNoticePeriodStatus = "Notice period Fully Served"
        Else
                GetNoticePeriodStatus = "Notice period Not Served"
        End If
End Function

That can be called with:

=Code.GetNoticePeriodStatus(Parameters!NPServed.Value, Parameters!NPServedasperPolicy.Value)

For completeness, here is the plain Expression equivalent:

=Iif((Not(Parameters!NPServedasperPolicy.Value Is Nothing) And (Not(Parameters!NPServed.Value Is Nothing))) And Parameters!NPServedasperPolicy.Value = Parameters!NPServed.Value, "Notice period Fully Served", "Notice period Not Served")
Sébastien Sevrin
  • 5,267
  • 2
  • 22
  • 39