How to create the default value for a List<String>?

I currently have a Python script that takes two parameters: some text for the first one, and then a list of names in the second one. For testing purposes, I’m trying to create a variable called ‘name_list’ of type List and passing in multiple names in order to make sure the Python script works, but I don’t know the syntax that I should put into the ‘Default.’

Say I wanted a list with two names, Bob and Joe. What syntax would I use to have those two values as a list in the ‘Default’ part of the variable tab?

1 Like

the syntax is like this
New list (of string)

to pass with values
New list (of string) from {“value1”,“value2”}

Cheers @sunya

2 Likes

When I do this, I get a error stating “There was an error while trying to serialize parameter http://UiPath.Python.Host:args. The InnerException message was 'Type ‘System.Collections.Generic.List`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]’ with data contract name ‘ArrayOfstring:http://schemas.microsoft.com/2003/10/Serialization/Arrays’ is not expected.” Am I using the wrong data type?

1 Like

hmm
i tried to reproduce it
its working fine
kindly make sure that the list is System.Collections.Generic.List(of string)

image

Cheers @sunya

1 Like

The type I have is System.Collections.Generic.List<System.String> , as the exact syntax you provided doesn’t exist in my type selection. Is that an issue?

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