Hi,
I am using RDLC in my reports.Can someone tell me the syntax for
IF THEN ELSE statement in RDLC?
I want to write else if loop in my expression.
Thnx in Advance

Recommended Answers

Add the custom code function or use IIF.

Jump to Post

Open report property, select the code tab and add following code,

public Function Chk(n as integer) as string
  if n>80 Then
   return "A"
else
 if n>70 Then
   return "B"
else
if n>50 Then
   return "C"
else
  return "D"
end if
end if
end if
end function

Set …

Jump to Post

All 5 Replies

Add the custom code function or use IIF.

Hi
Thnx for the reply.But I want the syntax for else if loop.My case is I have a field Marks.If marks >75 I want to display "Very Good", If 60<marks<74 display "Good",if 50<Marks<59 display "average".Hope u got what my requirement is.Please help me.
Thnx

Open report property, select the code tab and add following code,

public Function Chk(n as integer) as string
  if n>80 Then
   return "A"
else
 if n>70 Then
   return "B"
else
if n>50 Then
   return "C"
else
  return "D"
end if
end if
end if
end function

Set value expression of a field,

=Code.chk(Fields!Marks.Value)

Hi
Thnx for your help.It wrkd.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.