Adding to List

Trying to add to a List but getting an error

Main.xaml: Compiler error(s) encountered processing expression “DaysInMonth”.
Value of type ‘System.Collections.Generic.List(Of String)’ cannot be converted to ‘1-dimensional array of String’.

I am using a while loop to put each day in a month into a List.

Please show a screenshot from the right side panel when you click on “add to collection” in order for us to see how you configure it

can i see the property of add to collection ??

@Pradeep_Shiv @JuvRPA

what is the DaysInMonth data type??
@Nelson.R

It is a List of type string

did you initialized it?

Check this workflow, @Nelson.R
AddingDaysInMonthList.xaml (7.2 KB)

1 Like

I initialized it “New List(Of String)” in the variables tab

1 Like

Thank you. But can you explain how the invoke method works, how does it add each counter to the List? And why does this work and not the add collections activity that I am trying to use. The only differences I see are the invoke method and you initializing the List inside the sequence while i initialized it in the Variables tab.

@Nelson.R
is it working or can can you share your xaml for inspection

1 Like

@Nelson.R
Also have a look on this doing it direct approach

1 Like

the list is int32 so you can not do count.toString() ( delete the toString)

@JuvRPA

Count can be used
String List also can be produced

If you add the counter.toString() to the list , you are getting errors?

grafik

so problem solved?

I have counter.ToStringas the item option in the add to collection properties

@Manish540 had sent a workflow
DaysInMonths

In theirs they had used the Invoke Method to add the counter to the list. I just wanted them to explain how the method works and what are the reasons why I am getting my error.