How to validate both column name and indexing of an column

Hi Everyone,

my todays’s query is to validate column name and indexing on the column which should be fixed in format as well as in indexing

below is the column name

Sr No. , Account No. , Cif ID, Date, Extesnion

Hi @Lakshya_Garg2

Can you try the below

expectedColumns = New List(Of String) From {"Sr No.", "Account No.", "Cif ID", "Date", "Extesnion"}

actualColumns = DT.Columns.Cast(Of DataColumn).Select(Function(c) c.ColumnName).ToList()

If expectedColumns.SequenceEqual(actualColumns)
    ' Columns and indexes are as expected
Else
    ' Columns or indexes are not as expected

Regards,

Hi,

this will be used in invoke code or use in assign

@Lakshya_Garg2

expectedColumns and actualColumns variables are Assign activities (List(Of String) DataType)

If activity

Regards,

hi, Thanx for the solution
can you tell me one thing that this solution work for both scenario i.e. column name and indexing of the column

@Lakshya_Garg2

Yes, the SequenceEqual method compares the two lists element by element.

If both lists have the same elements in the same order , it returns True else it returns False

Regards,

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