Using ternary operator in Uipath

Hi,

I have a scenario where I have one null variable and another variable that has got some data in it so I tried to use the ternary operator to check for null value and assign data accordingly to the output value but I am getting error as shown in the image below.

TernaryOperator

I can do this using switch activity but I am trying to do it using a single activity. Are we allowed to use the ternary operator? If yes then what am I doing wrong?

3 Likes

Yah it would be like this buddy
IF(string.IsNullOrEmpty(textData.ToString),”Hello”,testData.ToString+”Hello”).ToString

Cheers @Sarvesh123

6 Likes

Hi @Palaniyappan
It worked. We can’t do testData.ToString as testData is set to Nothing but this syntax worked fine.

Fine
@Sarvesh123

Thanks for the help :grinning:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.