While condition

Hi, I want to do input a number, if it is not a number generates an error message box.
I write a code in python,

while True:
a=int(input(“Enter a number:”))
except ValueError:
print (“\n This is not a number. Try again”)
print ()

But I want code process in UiPath, I try in UiPath code getting some errors any one please help me.

What errors are you getting? Please share your workflow

Hi @447_J_U_S_SANDEEP ,

  1. Use the “Input Dialog” activity to prompt the user to enter a number. Store the result in a string variable, let’s call it “inputNumber”.
  2. Use the “Try Catch” activity to wrap the logic that attempts to convert the input string to an integer.
  3. In the “Try” section, use the “Int32.Parse” method to convert the input string to an integer. Store the result in an integer variable, let’s call it “parsedNumber”.
  4. In the “Catch” section, use the “Message Box” activity to display an error message to the user.

Here’s an example of the complete UiPath workflow:

# Step 1
inputNumber = InputDialog("Enter a number:")

# Step 2
    # Step 3
    parsedNumber = Int32.Parse(inputNumber)
    # Step 4
    MessageBox("This is not a number. Try again")
End Try


Hello @447_J_U_S_SANDEEP

Please check the below similar post.



Hello @447_J_U_S_SANDEEP
Kindly Refer to this Xaml file, You may get some Idea
Forum_IsNumeric.zip (149.1 KB)