I have above datatable.
Now if
Number is >=75 and Number<=100, Grade will A
else
Number is >=60 and Number<=74, Grade will B
else
Number is >=45 and Number<=59, Grade will C
else
Number is >=30 and Number<=44, Grade will D
Number is >=0 and Number<=29, Grade will E
I don’t want to use if-else, instead, can I use switch, also as per number i need to update the grade in DataTable.
Any help will be highly appreciated.
Here, No need of Switch Activity to update the Grade details in the DataTable. You can Write all conditions in assign activity with if Condition as Below.
row(“Grade”) = If (Num >=75 And Num <= 100 , “A”, _
If (Num >=60 And Num <= 74 , “B”, _
If (Num >=45 And Num <= 59 , “C”, _
If (Num >=30 And Num <= 44 , “D”, _
If (Num >=0 And Num <= 29 , “E”,“Not Applicable”)))))
Thanks a lot for looking into this.
One doubt i have, in below code:
If (Num >=75 And Num <= 100 , “A”, _
Why we have used _( Under Score) after “A” . As i tried code without _ and it works fine. Please manage sometime to look into this.
Underscore is To break a single statement into multiple lines. If you write entire statement in one single line without underscore also it will work. But, When you are writing lengthy statements prefer to use underscore to break the statement into multiple lines.