Assign Column value without using for each dt

How to assign a Column value as IssueKey.CustomFields(“Project Name”).Values(0)
without using for each dt
assing a column value directly to a dt at the end append the dt to an existing excel

1 Like

@AbarnaKalaiselvam

dataTable.Columns.Add("Project Name", GetType(String)).Expression = """Project Name"""

There are two scenarios here

  1. If it’s one row and one column

If you know the row column position of a datatable then use a assign activity like this

dt.Rows(rowindex)(“columnname”) = “your value”

Where rowindex starts as zero for first row

  1. If it’s all rows and one column

You need to write expression in Invoke Code activity.

dt = dt.AsEnumerable().ToList().ForEach(Sub(row) row(“ColumnName”) = row("ColumnName").ToString.ToUpper)

Note: Create one argument for Invoke Code activity and mention properties as below.

Name - dt
Direction - In
Type - DataTable
Value - dt

Hope this helps

Cheers @AbarnaKalaiselvam

dt.rows(0)(“PIN”) = IssueKey.CustomFields(“PIN”).Values(0)
Assign: Expression Activity type ‘VisualBasicReference`1’ requires compilation in order to run. Please ensure that the workflow has been compiled.

1 Like

Change the project type as WINDOWS or WINDOWS LEGACY and give a try
When creating a project you will get an option to choose it

Cheers


I want to update this PIN col = IssueKey.CustomFields(“Project Name”).Values(0)

Hi @AbarnaKalaiselvam ,

The Error is due to the Incorrect Double Quotes used, Re-Type the Double Quotes in the Expression (Not Copy Paste) and check :

dt.rows(0)("PIN") = IssueKey.CustomFields("PIN").Values(0)
2 Likes

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