How to save data in array

from application, I have been storing data in a variable using a loop condition (Do-while). I am printing it also.

Now I wanted to save this data in the array as it required to use in another sequence.

Please let me know how it could be done.


Hi @pridhvimallikharjun


Kindly try to use lis instead of array, if you are not sure about the no of data that we are going to store. Only if we know the number of data that we are going to have we can initiate the array , as only then we can use it…

So coming to the point,

  1. In do-while, add a counter with initial value as 0.
  2. then in create a list variable with list datatype of either string or int as datatype as you wish
  3. then with Assign activity keep the variable created at left side with counter as index and value you want to store in right side like,
    List_Name(Counter) = value to be stored
  4. increment the counter with assign activity by 1 like,
    counter = counter + 1
  5. this will work untill your do while condition is met

this is applicable if you are sure with no of data to be stored, thus using array. But we need to initialize array before using it as variable in our workflow like,

say if we have 9 data to be stored as integer,
------- new integer(10){} for int32[ ]
or as string
------- new string(10){} for string[ ]

Hope this would help you…!



Hi- Can you please check it once I followed you correctly or not

With this, I am getting a null exception error. Please correct it

HI @pridhvimallikharjun

No worries…! this null exception occurs when we dont have any reference to the variable with a value…Kindly check once is there variable without value and is used in the above screen shots contained activities.


I am still seeing the error.
I have attached xmal and error for your reference

Main.xaml (95.6 KB)

Hi @pridhvimallikharjun,

Saw your workflow buddy…it looks amazing, and you are almost done.

I have made small changes with counter and list initialization in the workflow, kindly runthis workflow (renamed as pridhvi). This would help you…Actually its your workflow only with small changes…:slight_smile:
pridhvi.xaml (104.5 KB)


1 Like

I am still seeing the same error

Hi @pridhvimallikharjun,

I think there is mistake in executing the xaml file.

The file i sent you has sequence name as pridhvi not main

To cross check counter will be pasted next to the assign list

find the attached xaml ,pridhvi.xaml (104.5 KB)

Kindly revert if you still face issue…We can resolve this together,no worries


I have executed the xmal file you attached but same error

Hi @pridhvimallikharjun,

Buddy, its working fine now and issue was due to assign activity having list assigned with. So replaced the assign activity with Add to Collection activity that can add data to the collection.

kindly make use of below xaml file .(resolved) pridhvi_resolved.xaml (103.8 KB)

Hope this would help you for sure…

Its working. Thank you so much.

I have two more questions in this regard. Please clarify

  1. How to display the data stored in list
  2. How to use the the data that stored in list


Thats amazing…!!

Alright lets get into your queires,

  1. To display the value in the list, there are two cases, like if you want to display only one value or all the values in the list.
    –for case 1, to display only one value (or even the specific value in a specific index) we can write like listname(index) and it can be displayed using log messages or writeline or message box as you wish
    –for cse 2, to display all the list, you can make use of for each loop and pass the list variable in the loop. Enter the type as what type you defined or list like string or int. Thats all you can display the list values.


  1. We can make use of list value, by writing similar to the above one like listname(index)

Hope this would help you. Kindly make the relevant one as solution if you feel it works fine.

Cheers…! Keep going

Thank you I am able to print all the values from the list

But in list last value storing as null. I want to remove it as it will cause fail in my next activity.

Please suggest

1 Like

Try this Buddy…!

This will work…

Kindly let me know for any suggestions or queries…

I tried to remove blank value from the list and also tried add a new value using Invoke method

both are not happening . can you please advise