jntrk
(jntrk)
November 26, 2020, 7:15am
1
Hey everyone,
I have an excel document which consists of 9/10 column. 2 of those columns are named “ProductNumber” & “DelDate” .
What I want to do is get the distinct Product Numbers (distinct, because there are some duplicates on the Prod.Num) , where there is no delDate given.
so:
Prod.Num/./././././DelDate
11223344/./././././
11223344/./././././
22334455/./././././12.12.2020
22334455/./././././12.12.2020
1111111111/./././././
0000000/./././././05.01.1999
So I want to get the values 11223344 & 111111111 and store it into an array for further processing.
I appreciate your help.
Ty,
Try this one
(From x in yourDT.AsEnumerable
Where isNothing(x(“DelDate”)) OrElse String.IsNullOrWhiteSpace(x(“DelDate”).ToString)
Let num = x(“ProductNumber”).ToString
Select num).Distinct.ToArray
jeevith
(Jeevith Hegde, Ph.D.)
November 26, 2020, 7:46am
3
Hi @jntrk , If you like to use Filter Datatable activity, then you could use this:
Filter Data Table
→ Column = "DelDate"
Condition "Is Empty"
and Keep rows
Second step assign an OutputArray =
OutputDatatable.AsEnumerable().Select(Function (a) a.Field(of string)(“Prod.Num”).ToString).ToArray()
Suggested workflow with annotations: FilterDatatable.xaml (9.4 KB)
jntrk
(jntrk)
November 26, 2020, 8:05am
4
Thank you this is working,
And also to do the opposite job (get the prod.nums with delDate), what kind of modifications should I do on your code
jntrk
(jntrk)
November 26, 2020, 8:11am
5
This also makes sense thank you I’ve never thought about it
park363
(UncleDev)
November 26, 2020, 8:13am
6
reference following code
dt.AsEnumerable().
Where(Function(r) r.IsNull("DelDate") Or String.IsNullOrWhiteSpace(r("DelDate").ToString)).
Select(Function(r) r("Prod.Num")).Distinct.ToArray
The line with where is conditions for blank deldate.
Where Not String.IsNullOrWhiteSpace(x(“DelDate”).ToString)