Click here to Skip to main content
15,884,628 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
VB
=Switch(
    Fields!C2.Value = "","",
    Fields!C2.Value > 0,Fields!SeqNo.Value
    )

What is the syntax for this?


I wont to compare variable like

C#
if(C2 ==" ")
   {
    C2.Value = empty
   }
   else
   {
    C2.Value = Fields!SeqNo.Value
   }
Posted
Updated 2-Dec-14 19:34pm
v2
Comments
DamithSL 3-Dec-14 1:19am    
Any errors with this expression or is it not working?
[no name] 3-Dec-14 1:26am    
Error Line.
#Error UNITED ARAB EMIRATES
1. 81409702
2. 81410891
#Error CANADA
3.81410452
DamithSL 3-Dec-14 1:33am    
in "UNITED ARAB EMIRATES" case what you want as answer?
[no name] 3-Dec-14 1:37am    
I wont to Flowing Answer

. UNITED ARAB EMIRATES
1. 81409702
2. 81410891
. CANADA
3.81410452

1 solution

your code seems OK but what if both conditions not match? I have added default value for final condition.
=Switch(
    IsNumeric(Fields!C2.Value) and  Fields!C2.Value > 0, Fields!SeqNo.Value,
    1=1, Fields!C2.Value
    )


UPDATE:

for below:
C#
if(C2 ==" ")
   {
    C2.Value = empty
   }
   else
   {
    C2.Value = Fields!SeqNo.Value
   }


try
=Switch(
    Fields!C2.Value = " ", "",
    1=1, Fields!C2.Value
    )
 
Share this answer
 
v3
Comments
[no name] 3-Dec-14 1:28am    
am faceing same error.
DamithSL 3-Dec-14 2:13am    
check my updated answer
[no name] 3-Dec-14 2:41am    
Seq Number not display .flowing result display
UNITED ARAB EMIRATES


801106875 81409702
[no name] 3-Dec-14 3:01am    
Thank you DamithSL

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900