I am working on project which is based on Excel, In this we received a mail containing excel attachment which have only one row in Each Excel (Each mail Contain Only One Excel).
If “Client Code” column is blank, then skip the transaction. and Must go to Next transaction.
How we can achieve that ?
hope the below steps would help you resolve this
- use a READ RANGE activity and get the output as a datatable of that excel file
- now use a IF condition and mention like this
dt.AsEnumerable().Where(Function(a) NOT String.IsNullOrEmpty(a(“Client code”).ToString.Trim) ).CopyToDatatable().Rows.Count.Equals(1)
if true it goes to THEN block or goes to ELSE block based on which you can process the transaction
If it is a REFramWork Project When you Send the Row Item as a transaction Item you can put this Expression if (String.IsNullOrEmpty(row(“Client Code”).ToString) in then (Throw Exception or Log Message or Leave it Empty and in Else you can make your Activity or Task))
if its a Work Flow or Sequance after Reading the Excel Sheet you Can Use For Each Row Data Table and Put the same Expression above.
please try this which will give true or false
- Read the data into Datatable
dt.AsEnumerable.Any(function(x) IsNothing(x("ClientCode")) OrElse String.IsNullOrEmpty(x("ClientCode").ToString.Trim)) use this in if condition
- on then side ignore and dont process and on else side do your actual process