Inititate List<string> - Index was out of range

Hello,
im using a list<string< to get information out of a forms, but i need to initiate this list with 8 values, its possible to do at here?


if not, how to do different ?
i need to input the information in another activities but when the forms use just 4 of the 8 spots the activity return an erro
image
im assuming that the error is because i didnt initiate the list
image
if in the forms i select 8 of the options it works fine, but if i select less than 8, comes that error

Test with this:

New List(Of String) From {"1", "2", "3", "4", "5", "6", "7", "8"}
1 Like

Hi @Leonardo_Andreola

New List (Of String)() Initiate like this instead of {“0”} in the Variable panel and give a try

Cheers

It kind work but i still get the error
I select 1 item in the forms and printed the second but didnt print “0”, look like the forms empty the list and replace with the single item i select

It should work fine. Do you have anything else in your workflow that modify the Options list?

image

image

yes, let me go from the top, i create a forms with 100 options to be select, the person who use the system will select between 1 and 8 files, and i need to know how much files he selected.
The Option list come from the form, i was trying to add this itens at a activity i build i c# to count how much itens was selected, because List dont allow .Length, if you know other way to get this length of the List will kill this problem


Have you tested with Options.Count to get the number of the elements in the list?

1 Like

i cant believe thats a think, omg it works, im like, 3 days working in that hahahaha, i know so little about uipath, ty alot mate

1 Like

Check if you are using a different variable??

1 Like

its the same, but the forms reset the options i initiate in the variable

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