Good Day.
I am trying to validate the columns in an excel. However, I cannot print out the missing column. How can I print the missing column? Kindly refer to the picture below for further details.
Thank you.
Best regards,
Robert
Good Day.
I am trying to validate the columns in an excel. However, I cannot print out the missing column. How can I print the missing column? Kindly refer to the picture below for further details.
Thank you.
Best regards,
Robert
Use for each and change the type to datacolumn
For each item in dt.column
Print item with the if spedified if condition.
If (item.contains(“#”) and …
Then print item.tostring
Regards
Can you elaborate?
Steps would be as follows below.
Read range the excel and create a out dt variable.
Use for each and change type as object to datacolumn
. For each. Item. In ReadDt.columns in for each activity
Item holding all the column present in the worksheet!
Use If condition as you specified !
Like item.contains() and item.contains()…
Condition satisfies then part write line item.tostring
Else leave blank.
Hope this helps!
Regards
You’d have to loop through your expected column names, and then check if that column name exists in Columns, and if it doesn’t Log Message to print it ou.
According to @Yoichi, it is one of the solutions
First, create string array named names which has column names which is checked.
Then condition of IF is names.All(Function(s) dt.Columns.Contains(s))
And in Else, we can get missing column name from String.Join(",",names.Where(Function(s) not dt.Columns.Contains(s)))
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.