uiStijn
(Stijn Ekkelboom)
1
Hey Guys,
I’m trying to build a switch that checks if my number is lesser than 100, greater than 100 but lesser than 1000, or greater than 1000.
My current expression:
If(CDbl(myMax) < 100, “Lesser than 100”, “”) ElseIf(CDbl(myMax) > 100 AndAlso CDbl(myMax) < 1000, “Between 100 and 1000”, “”) ElseIf(CDbl(myMax) > 1000, “Greater than 1000”, “”)
i’m getting an error:
Error ERROR Validation Error Compiler error(s) encountered processing expression “If(CDbl(myMax) < 100, “Lesser than 100”, “”) ElseIf(CDbl(myMax) > 100 AndAlso CDbl(myMax) < 1000, “Between 100 and 1000”, “”) ElseIf(CDbl(myMax) >= 1000, “Greater than or equal to 1000”, “”)”.(2) : error BC30198: ‘)’ expected.
Were should the closing parenthesis be?
Yoichi
(Yoichi)
2
HI,
Can you try the following expression?
If(CDbl(myMax) < 100, "Lesser than 100", If(CDbl(myMax) > 100 AndAlso CDbl(myMax) < 1000, "Between 100 and 1000", If(CDbl(myMax) > 1000, "Greater than 1000", "")))
Regards,
uiStijn
(Stijn Ekkelboom)
3
That was fast, thanks Yoichi! Why was my expression wrong?
1 Like
Yoichi
(Yoichi)
4
Hi,
“If” operator (in VB) doesn’t have elseif. Please also see the following document in details.
Note: “If-then-else” statement has it.
Regards,
1 Like
uiStijn
(Stijn Ekkelboom)
5
Thank you, i’ll read this!
1 Like
uiStijn
(Stijn Ekkelboom)
6
Yoichi, are the expressions in UiPath single-line syntaxes?
' Multiline syntax:
If condition [ Then ]
[ statements ]
[ ElseIf elseifcondition [ Then ]
[ elseifstatements ] ]
[ Else
[ elsestatements ] ]
End If
' Single-line syntax:
If condition Then [ statements ] [ Else [ elsestatements ] ]
Yoichi
(Yoichi)
7
Hi,
In UiPath, as far as i know, we can use this If statement in only InvokeCode activity
Regards,
1 Like
system
(system)
Closed
8
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.