How to create a column with bulk values

Hi,

I will be getting the Employee count from Application Interface using get text activity (Ex: 60 Employees). Based on the Employee count value(60) I have to create Column and have to add 60 items in it like 1,2,3…60. How to create this in bulk in one go? is it possible?
If anyone knows please clarify

Hey @User0903,

Use Enumerable.Range(1, CInt(EmployeeCount)).ToList in an Assign activity to generate numbers from 1 to 60.
Convert the list to a DataTable using Generate Data Table or by building it programmatically.
Write the DataTable to Excel with Write Range to create the column in one go.

1 Like

Hello, @User0903
U Can use this one
Yes, possible
Use Assign activity with Enumerable.Range.

Example:
empCount = CInt(System.Text.RegularExpressions.Regex.Match(empText, “\d+”).Value)
myList = Enumerable.Range(1, empCount).ToList()
empText = "60 Employees" (from Get Text) empCount = 60
myList` = {1,2,3,…60}

Then use Build DataTable (with 1 column) + For Each to add rows, or directly Generate DataTable from string if needed.

Please check this one and Do needfull

@User0903

A little extension to what @Mir.Jasimuddin has provided

Use generate datatable from text with row separator as newline and input as String.Join(Environment.NewLine,Enumerable.Range(1, CInt(EmployeeCount)).Select(function(x) x.ToString))

Cheers

2 Likes

Get Employee count and create a data table with only one column.
Then use below command

dtResult = (From i In Enumerable.Range(1, empCount)
Select dtRow = dt.NewRow()
Let x = dtRow(“EmployeeNumber”) = i
Select dtRow).CopyToDataTable()

Here dt is data table created with 1 column
EmpCount = employee count(extracted and counted after get text)
DtResult = result data table

If employeeCount = “60”, the resulting DataTable will look like:

EmployeeNumber
1
2
3

60