Search code examples
user-interfaceif-statementconditional-statementsuipathuipath-studio

UIPath. Vb.net? if condition


Im new to uipath and coding in general. I know most of the basics from what was taught but they didnt go through how to form "condition" statements in the "if" activity. or basically any form of conditions. Where can i go about to learning them? is it a specific language?

kinda like: not Months.Contains(ExpenseMonth)

i wouldnt be able to come up with that because i dont know what is acceptable/readable to uipath studio

also regarding those calculations. where can i find more information on those? to learn more about

kinda like: (int32.Parse(row("Value").ToString) * 100 / monthlyTotal).ToString

they didnt really give me details on how to form that

so essentially, if i wasnt spoon fed with those statements, i would be stuck


Solution

  • It depends on which activity you are using. Usually it's VB.net. Find more about that programming language here.

    And yes you will need to get the basics of that language on your own. UiPath isn't really helping you find the correct condition. It is more a tool that can use VB.net.

    And soon you can switch to C# completely. But that is not yet ready and still experimental. Also, I would recommend you to stay with VB.net as it is way easier to learn as a first language. Currently, you can only use C# and Invoke Code activity.

    To your first example from above:

    not Months.Contains(ExpenseMonth)
    

    That depends on your variable type. That looks like a DateTime or a String type and so you are able to use predefined functions that come with it. You can show them but simply clicking CTRL + SPACE after the dot.

    And your second one:

    (int32.Parse(row("Value").ToString) * 100 / monthlyTotal).ToString
    

    I would always recommend you to use CInt instead of int32.parse. Look here. And it is often not needed to convert the row value into a String. As it is usually already in that type by default.

    But again. You will need to learn the basics of VB.net before you are able to write a good business logic in UiPath that makes sense and is best practice.