Initialize the list

How can i initialize the list in my work flow and add the values to that and write to excel
Can any one help

1 Like

Hi @Swathi_Raju ,

New List(Of String){“Your Value here”}

1 Like

@Swathi_Raju

List initialization

If it is string New List(Of String)

For writing to excel you need a datatable or string values and not a list

Cheers

Hi

U can initialise like this

If u want to create a list of string then in assign activity

Listvar = New List(of String)

If u want to initialise with values also

Then in assign activity

Listvar = new List(Of String) from {“A”,“B”,“C”}

Where Listvar is a variable of type System.Collections.Generic.List(of String)
U can browse this in variable panel

If u want to add values later to the same list then use this expression

Listvar = Listvar.Concat({“Item1”,“item2”,“item3”}).ToList()

Hope it covers all ur scenarios @Swathi_Raju

U can add this to datatable first and then to excel

To add it to datatable use the below steps

  1. Use for each activity and pass the above list variable as input and change the type argument as string

  2. Inside the loop use a ADD DATAROW activity where pass the list value as ArrayRow property like this {item.ToString} and database as dt

  3. Now U can write this datatable using WRITE RANGE workbook activity

Cheers @Swathi_Raju

1 Like

Hi you can try this way

at the end you can use the write range work book to write excel

output :
image

Note : list variable type = System.Collections.Generic.IEnumerable<System.string>

@Swathi_Raju

2 Likes

Can you share the xaml please @Praveen_Mudhiraj

These are the steps involved @Swathi_Raju

@Swathi_Raju

list.zip (2.3 KB)

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