How to add Data to a specific Column Without Loop

Hello all, I want to update some data to a specific column of first row in a datatable using assign activity without suing loop. Can anyone help me with this?

@Aswini

You can do like this

dt.Rows(0)("ColumnName") = "Value"

cheers

HI @Aswini

Have you Tried with Write cell activity?

or

Use For each Row in Data Tbale activity (Inside the Loop)

Use Assign activity

Currentrow("ColumnName") = "Value"

Regards
Gokul

I have tried this but getting error “Exception has been thrown by Target of Invocation.”

Hello, i want to add to data table but not to excel.

Hi @Aswini

Try this

YourDataTable.Rows(0)("ColumnName") = "NewValue"

Hi @Aswini

Have you tried with Add data row activity

image

Hey @Aswini

It is working

Please try this

image

Input DataTable:

image

O/P:

image

@Aswini

May I know where did you try

Did you try in invoke code?

Cheers

Hi @Aswini

Check these steps:

  1. Double check that the column name is spelled correctly and exists in your Datatable.
  2. Verify that the Datatable is not null or empty.
  3. Ensure that the column data type matches the data type of the value you’re trying to assign.

i tried in Assign activity

Thanks for answering. I have tried the same but getting error ’ Exception has been thrown by Target of invocation. ’

Can you show the screenshot of how you are trying @Aswini

and try to run the code in debug mode then you will find out where the error occurs

@Aswini

can you share the screenshot where you are getting error

cheers

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