Can I use variables in Build Data Table?

Here you can see in the attached picture, I am building data table and I want to append it to workbook.
the thing is I want to use variables inside.
So, I have changeable values that I want to add every time, that’s why I want to use variables inside the data table

any ideas ?
thanks in advance

image

@tamim1640

For adding data into a Data table use add data row activity and pass the variables in it.

Regards,
A Manohar

Hi @tamim1640,

Please use Add Datarow activity,

you can pass variables in ArrayRow property. Sample: {yourVariable}

Thanks!

but to use “add data row” I need to type in the DataTable, and I cant do that without using variables because my values are changeable and I am storing them in the variables

many thanks

image

Hi
no buddy we wont be able to use variables inside the BUILD DATATABLE ACTIVITY
if we use we will getting output like this only


so
we need to use a simple assign activity so that we can replace the cell value with a variable we want as ADD DATA ROW activity will add only a new row for each time…

so to use a assign activity
yourdatatable.Row(rowindex)(columnindex) = yourvariable.tostring

where both row index and column index starts from 0 for the first row and first column
Cheers @tamim1640

1 Like

@tamim1640

use For each row
and in that use add data row
in Array list just pass the variables as {var1,var2}

I am getting variable1.tosting latterly in the excel but not the value.

many thanks

1 Like

now I am getting
Object reference not set to an instance of an object

where, checkvar is a variable.
built is data table

image

@tamim1640

If your getting values from Excel sheet Then.
If you want to get a specific value from Excel use.
var1=Datatable.Row(rowindex)(columnindex)

If you want to get all values from a specific value in Excel use
var1=row(“columnname”).to String(in For each row)

Then use add data row and in array list mention the variables

yah but assign will work
for example

Cheers @tamim1640

1 Like

Thank you, its working now

1 Like

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