Remove Data Column bug

Hi,
I found a small bug with ‘remove data column’ activity.
When i pass column object to activity (Input->Column) i get a validation error: ‘None of the overload groups have all their required/optional activity arguments configured’. When i add column name (Input->ColumnName) validation error is gone but when i run it i get an error: ‘System.ArgumentException: Cannot remove a column that doesn’t belong to this table.’ (tries to delete the column twice).

Tested it on versions 2019.4 and 2019.10

Hi @Kelebrim,
Can you attach a workflow or some screenshots so we could check that out?

Check the column name you are trying to remove actually exists in the data table or not at Run time (use breakpoints)


Item is datacolumn

Hi @Kelebrim

I believe you cannot remove a column while actively iterating through the same Data Table.

I would approach it from another side - first generate an array of column names you want to delete, and then iterate that array with For Each to delete specific columns in your DT.

Something like that:

2 Likes

Hello, no the output DT is clone of input DT in the beginning of workflow.

Can you explain this statement? Are you trying to delete the statement twice or someother?

I assume activity tries to delete the column twice if you input columnname and column (the object), in documentation it is said that:
“If this property (Column) is set the ColumnName and ColumnIndex properties are ignored”

Since i get an error that column is already removed

You have to pass either the column name or column object @Kelebrim.

When i pass column object only i get validation error: ‘None of the overload groups have all their required/optional activity arguments configured’,

In either case, you simply cannot remove a column from a Data Table while doing a For Each on the columns of that Data Table.

I think the real bug here is twofold:

  • the syntax error message you get when using the column variable is not informative enough
  • the Remove Data Column activity does not throw a warning when you are using the name of the Data Table Column you are iterating
    (I am not sure if this is possible to fix, as the Data Tables are evaluated at runtime).

Maybe the new Workflow Analyzer feature could help here by pointing out the issue, what do you think @coramia?

Hi!
Currently we do not have a rule in the Workflow Analyzer feature to treat such a case, so the short answer would be no, we are unable to point out the issue for the moment using the Analyzer.

That being said, I will raise this as a discussion within our product team to see if we can provide a context to create a rule to treat similar cases as the one described above. But please bear in mind that such a rule would need to be generic enough to treat all cases - Data Tables, Excel files, Collections, etc. that are used within a For Each activity, and it may be a challenge to define it exhaustively.

1 Like