I cannot find anywhere online that shows how to create an enum in UiPath for example a List of type string is in this format New List(Of String)(new string(){“text”})
Is there similar for creating an enum?
Thanks,
Monica
You can append .AsEnumerable to convert to enumerable. It looks like in your example though, you havea list of string, but then provide an array of strings so there may be a syntax error in your example, perhaps you wanted New List(Of String()) instead?
Hi @AshwinS2 I have an empty variable as System.Enum and I am looking for what to populate it with,
Thank you
Hi @Dave
Apologies, yes in my example it is an array list of strings, I just want to create an enumerable in the similar format, I am not looking to convert an existing variable,
Thank you
Hi @monica.ryan
Use ienumerable var={“test1”,“test2”}
Use for each item
Print the item
Thanks
Ashwin.S
Hi @AshwinS2
Apologies but I still cannot figure this out, UiPath and vb .net are both new to me.
Could you explain further?
Thank you.
Hi @monica
Create a variable as enumvar in variable pane and variable type as system.collections.ienumerable and pass the values inside as {“value1”,“value2”}
And do the manipulations
Thanks
Ashwin.S
Hi @AshwinS2
Thank you for that, I can now create an IEnumerable variable, however how do I convert this to a System.Enum which is the variable that I need,
Thanks,
Monica
This seems to be the first google hit, so I’m replying here.
There is no way to directly create entities like Classes, Enums or Structs from inside UiPath Studio.
This has been frequently requested, (like here or here).
Looks like the solution is the new UiPath Data Service, which unfortunately I can’t use (stuck on 2019.10, this was released with v2020.08) but it might help others out there.
Cheers
As a workaround to the “No Enum” issue in UiPath, I created an empty class in a UiPath Custom Activity (no need to add any activity ) in Visual Studio. (Since we cant create classes in UiPath)
I then added a list of get properties to the class , each just returning a string
e.g.
public class ReFram
{
public string ExScreenshotsFolderPath { get { return “ExScreenshotsFolderPath”; } }
public string MaxRetryNumber { get { return “MaxRetryNumber”; } }
//etc
}
Then imported this to my UiPath project in Studio and declared a variable of this type. I’m then able to use intellisense to get all my string values for config files / datatable columns / Excel header names etc