How to make assign code simple for data table

I am changing the columns names of a data table. For 10 columns i individually used assign activity.Is there any simpler way to write al in same assign node?
image

you can decrease the redundancy by

  • build datatable - 2 cols: oldName, NewName - dtNameConfig
    • populate dtNameConfig
  • For each row in dtNameConfig
    • assign Activity: dtOrig.Columns(row(0).toString).ColumnName = row(1).ToString

as an alternate, we can also do it via a dictionary, JSON…

UPD1 -
Bug fix in the code suggestion

1 Like

it would be gr8 if you can show a sample.

1 Like
  • Use a For Each loop to iterate through columns.
  • Inside the loop, use an Assign activity with this code:

dt.Columns[column.Index].ColumnName = ‘ColConfig_“+column.Index + 1+”’ /get this value config file give naming convention like/

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