DimitriLYR
(DimitriLYR)
December 8, 2022, 11:32am
1
Hello everyone, I searched the forum but I did not find the solution to my problem.
I have an excel file which I save in a DATATABLE.
I browse the DATATABLE with the following condition:
If the date is >= today’s date, I have to add it in an array to be able to delete it later because I can’t use the “delete a row” activity in a foreach
I used the “add to collection” activity but it still returns me the current items
I would like to be able to add these elements in an array to make a filter later in my datatable and to remove the dates which are not >= to the current date
Merci pour votre aide
Anil_G
(Anil Gorthi)
December 8, 2022, 11:41am
2
Hi @DimitriLYR
Use a list instead…Arrays size is fixed…List is what you need to use
and use this
https://docs.uipath.com/activities/docs/append-item-to-collection
cheers
DimitriLYR
(DimitriLYR)
December 8, 2022, 12:33pm
3
Thanks for the reply, here is what I did:
However when I do a foreach, I only have one item (the last)
I would like to add all the elements of my DataTable that match my condition
Anil_G
(Anil Gorthi)
December 8, 2022, 12:50pm
5
Hi @DimitriLYR
That is because you are everytime appending the output with new list
Please use same collection in in and out
Yes I know this is simple but I hope some people find it useful.
I am posting this answer as this question keeps coming up since the new update (2022.10.3).
Questions
Not “Add To Collection” in Activity Panel
What to use instead “Add To Collection” Activity in Newupdate(2022.10.3)
The answer to both these questions is the same
Add To Collection Old (2022.4.6)
[image]
[image]
Variable type is “system.collections.generic.List<system.string>”
Append item to collection New (2022.10.3)
We …
cheers
Anil_G
(Anil Gorthi)
December 8, 2022, 1:02pm
6
@DimitriLYR
Please see on how to add the elements
Make sure you initialize the list
output
Hope this helps
cheers
DimitriLYR
(DimitriLYR)
December 8, 2022, 1:27pm
7
Thanks ! I
had initialized my list in the foreach… Beginner’s mistake, so my list is reinitialized each time…
Thank you again