Updating all rows of a column together

Hi

I was wondering if there is any way to update all the rows of a particular column in a data table/data row array in one - go?
For eg. I need to update the column of a data table or an array of data rows with a static value in one go instead of using any kind of loop.

This will set the column ‘col1’ with the string value ‘a’

Datatable.Columns[“col1”].Expression = “‘a’”;

Just try this… Hope it will help.

2 Likes

Hi @jibanjyoti
This gives an L value error and so isn’t working. :frowning:

can you paste the screenshot of your Assign activity where you have written the above code?

Hi @jibanjyoti
Sorry my bad. I didn’t include the single quote inside the double quote.

Thanks alot. It works. :slight_smile:

2 Likes

Nice help, expressions is a nice way, instead of a loop. It’s to think like excel formulas.

I’m having a problem then, when i process a datatble with some columns with expressions; when i do a “Write Range” to a workbook, the header name of this columns is strabge! (original_name + expression_detail), i woul prefer just the original_name on the header.

Do you know how to do this?

By now we are using a workarround; to save de datatable on CSV and then load from the CSV to a new Datatable to write the Excel then; but is not a nice way i think.