I have a csv file with 65 columns, and I need to verify if there is ANY (numbers, letters, or symbols) value in a specific column before running activities. For example, I need to see if there are any email addresses listed under Column A “NewAssociateEmail”.
you can use lookup datatable activity, if you got results then it means that the value exist, if not then the value is not listed there
Regards!
HI,
How about the following expression? This returns true if all the cells in column “NewAssociateEmail” have some value.
not dt.AsEnumerable.Any(Function(r) r("NewAssociateEmail") is Nothing OrElse String.IsNullOrEmpty(r("NewAssociateEmail").ToString))
Regards,
Hi @Amber_Haworth1
=> Use Raad CSV acitivity to read the Excel and store it in an data table say dt
.
=> Use the below syntax in Assign acitivity:
ResultFlag = DataTable.AsEnumerable().Any(Function(row) Not String.IsNullOrWhiteSpace(row("NewAssociateEmail").ToString))
Note: ResultFlag is of DataType System.Boolean.
=> Use an If activity and give below condition:
If
ResultFlag
Then:
// There is a value in the specified column
// Perform your activities here
Else:
// No values found in the specified column
End If
Hope it helps!!
Hi,
-
use read csv activity
-
Assuming dt is your DataTable and columnName is “NewAssociateEmail”
use Assign activity
anyEmailsExist As Boolean = dt.AsEnumerable().Any(Function(row) Not
String.IsNullOrEmpty(row.Field(Of String)(“NewAssociateEmail”))) -
use if condition
If anyEmailsExist Then
Perform your activities here
Else
No values found in the specified column, handle accordingly.
End If
This worked! Thank you all for your help.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.