How to add element in list at desired index position in assign activity?
HI,
We can achieve it using InvokeMethod activity instead of Assign, as the following.
Sample20230227-3L.zip (2.3 KB)
Regards,
Hi @Ketan_Wajekar,
In assign you can just add the list_name(index) to the left and value to the right and it will work. like in the screenshot below.
If you have a new element that needs to be added to list, then simply use:
“Add to Collection” activity or “Invoke Method” activity with method name as ‘Insert’.
If you want to change index of an element that exists in the list, then use:
Get old index of your element
Remove the element from its old index.
Insert the element to new index.
In the below screenshot, you can check that element “a” has been moved from index 3 to index 0.
Invoke Method - RemoveAt:
Invoke Method - Insert:
AddChangeItemIndexInList.xaml (7.9 KB)