Hi,
Can you help me write a if Statement.
If dt(datatable) contains any value in c column( column name).
Hi,
Can you help me write a if Statement.
If dt(datatable) contains any value in c column( column name).
Hi @RACHEL_PAUL
Try this:
If dt.Columns.Contains("ColumnName") AndAlso dt.AsEnumerable().Any(Function(row) Not row.IsNull("ColumnName")) Then
' DataTable contains at least one value in the specified column
' Your code here
Else
' DataTable does not contain any value in the specified column
' Your code here
End If
Hope it helps!!
Hi @RACHEL_PAUL
columnHasValue = dt.AsEnumerable().Any(Function(row) Not String.IsNullOrWhiteSpace(row("C").ToString()))
If columnHasValue Then
Log Message: "Column 'C' contains at least one non-empty value."
Else
Log Message: "Column 'C' does not contain any non-empty values."
Hi @RACHEL_PAUL ,
You can try below Linq
dt.asenumerable.any(function(r) String.IsNullOrEmpty(r("Column2").ToString))
So basically this linq will check if there is value in that column,
If there are no values , then it will out TRUE
If there are values in that column , it will out FALSE
Below is the example for your reference:
Hope it helps you out!
So basically the vaules mentioned in the C coulmn are the names of images in a folder.
Can you help me write the code for:
For each value in C column
Can you try like below
DT.AsEnumerable().Any(Function(row) Not String.IsNullOrWhiteSpace(row(2).ToString()))
CurrentRow(2).ToString.Equals(Path.GetFileNameWithoutExtension(CurrentFile.ToString))
Cheers!!
It is not working
So the column name i use is Picture_Name.
If any data is present in Picture_Name( ColumnName) of dt(datatable)
Get the name from the column
open folder
Find the picture name and copy to clipboard
Try this
DT.AsEnumerable().Any(Function(row) Not String.IsNullOrWhiteSpace(row("Picture_Name").ToString()))
CurrentRow("Picture_Name").ToString.Contains(Path.GetFileNameWithoutExtension(CurrentFile.ToString))
Hey,
So it is copying the text, but i need to copy the picture of the text to clipboard not the text
Hi,
Suppose the column (Picture_Name) contains a value “capture1.png”.
I have to search for “capture1.png” image and copy to clipboard.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.