Check position column

I have a process that has an input excel and I need to check if the table columns are in a certain position.

EJ:
Name Age City

I need to check if Name is in position 0, Age in position 1 City in position 2

assumption: DataTable - dtData

Assign Activity:
arrMissplacedCols | String Array
{"Name","Age", "City" }.Where(Function (x,i) Not i.Equals(dtData.Columns(x).Ordinal)).toArray

when there is a misplaced column we will get it within the arrMissplacedCols

UPD1 -) Fix and Visualizations
grafik

And
grafik

2 Likes

From your other posts we would assume that it is always a 3 col data. Instead of checking we can also do a direct fix / order force by

dtData = dtData.DefaultView.ToTable(False, {"Name","Age", "City" })

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