I want to check all the values in a particular column is similar,if it is similar it should throw error.
In the above all values are similar to certain string(kkk), so it should throw error,
If the one value contains different then it should not throw error.
Use Read Range activity to read the data from excel file and it will give output as DataTable. Let’s say ‘InputDT’.
And then try below expressions.
Int UniqueRowCount = InputDT.DefaultView.ToTable(True,"ColumnName").Rows.Count Int DuplicateRowCount = InputDT.DefaultView.ToTable(False,"ColumnName").Rows.Count If UniqueRowCount = DuplicateRowCount Then Column does not contain duplicate rows Else Column contains duplicate rows
Can you try the following condition in IF activity?
Hope the below steps would help you resolve this
Let’s say you have a datatable named dt with the column values
And the same value lies in Column-2
Use a assign activity like this
int_rowcount = dt.Rows.Count
Where int_rowcount is a variable of type int32
- Now use a REMOVE DUPLICATE Rows ACTIVITY where pass input as dt and get the output as dt
- Now use a IF activity like this
int_rowcount <= dt.rows.count
If true it has no duplicate records where it goes to THEN block and if false it has duplicate records where it goes to ELSE block
In then block leave it as it is
And in else block use a THROW activity and mention like this
new BusinessRuleException(“Your exception message”)
Thank you all for giving solutions
Do you have any further queries on this topic
No,I dont have
Pls close this topic with right comment marked as solution