Hello Friends,
I want to display non empty/non null rows based on column “country”.
I am getting error as shown in below screenshot,
LINQ :–>
(
From currentRow In DataTbl
Where Not currentRow(“Country”).ToString.IsNullOrEmpty
Select currentRow
).CopyToDatatable
May i know why i am getting this error? and how to resolve this error?
1 Like
ppr
(Peter Preuss)
March 16, 2023, 5:26pm
2
(From d In DataTbl.AsEnumerable
Let chk isNothing(d(“Country”)) OrElse String.IsNullOrEmpty(d(“Country”).toString.Trim)
Where Not chk
Select r = d).CopyToDatatable
Handle empty filter result by:
[FirstAid] Handling of The source contains no DataRows exception - News / Tutorials - UiPath Community Forum
Also have a look here:
[HowTo] LINQ (VB.Net) Learning Catalogue - Help / Something Else - UiPath Community Forum
Hi @Neal369
Try this
(
From currentRow In DataTbl.AsEnumerable
Where Not String.IsNullOrEmpty(currentRow(“Country”).ToString)
Select currentRow
).CopyToDatatable
Hope this helps
2 Likes
@Neal369
Alternate Approach:
dt.AsEnumerable.SkipWhile(Function(row) String.IsNullorEmpty(row(“country”).ToString)).CopyToDataTable
Hope this helps,
Best Regards.
1 Like
ppr
(Peter Preuss)
March 16, 2023, 5:49pm
5
This HowTo gives an introductory overview of the partition Operators: Skip, Take, SkipWhile, TakeWhile
Introduction
The partition operators are used to fetch a particular subset from a set of items. The returned subset is formed by the contiguous items that are matching the provided condition.
Skip / Take Operator
The Skip Operator will omit the subsequent items from the given start for a given length and will return the remaining items
The Take Operator will return the subsequent items fr…
We keep in Mind:
Col Value Sequence: A, B,C, NullOrEmptyString, E, F
SkipWhile will stop after C and not return E,F
1 Like
This is not working,
Giving below error -
Anil_G
(Anil Gorthi)
March 16, 2023, 5:51pm
7
@Neal369
I believe you copied the formula directly and pasted it…the error is becUse of the inverted comma…please remove it and re add it…that would solve the error
Cheers
1 Like
ppr
(Peter Preuss)
March 16, 2023, 5:51pm
8
Always ensure or retype all Double Quotes as it has to be: "
sometimes copy paste will cause this issue
1 Like
@Suraj_B_Shetty
This works perfect, thank you
1 Like
Correct, my apologies, thank you
1 Like
Working perfect,
Thank you
1 Like
system
(system)
Closed
March 19, 2023, 6:06pm
12
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.