How to filter complex datatable for below problem?

Kindly help to filter particular set of data L:101

Input
ITEM Projected Value A
L:100 Fill Risk Up
BB Projected Cases -90
TOTAL FILL RATE - $1488 Fill Risk
ITEM Projected Value B
L:101 Fill Risk Down
AA Projected Cases -55
TOTAL RATE - $3 Fill Rate Risk - Cases
Output Search for L:101
ITEM Projected Value B
L:101 Fill Risk Down
AA Projected Cases -55
TOTAL RATE - $3 Fill Rate Risk - Cases

@ppr Could you please help to filter the datatable if we search L:101 then it should filter set of data as shown in output

input data is not complete clear, maybe you can elaborate more on it.

When filtering L:101 it looks that some rows from above/below are also to place in the output

Yes excatly if we filtering L:101 then it should pick above and below rows sir as Output from the datatable

Output
ITEM Projected Value B
L:101 Fill Risk Down
AA Projected Cases -55
TOTAL RATE - $3 Fill Rate Risk - Cases

then we would recommend to define the set of surrounding rows and retrieve the rowindex of L:101

is that possible to get the rowIndex for the search item using LinqQuery because there is more data to loop and check

dtData.AsEnumerable.ToList.FindIndex(Function (x) x(0).ToString.Trim.Equals(“L:101”))

will return the 0-based index or -1 when not found

1 Like

Thanks bro for the answer @ppr

Let us finalize the case and find some starter help

sample Data
grafik

Index retrieval
grafik

Extraction
grafik

feel free to dynamize it with additional variables and incorporate additional checks within the flow (e.g. not found check)

[HowTo] LINQ (VB.Net) Learning Catalogue - Help / Something Else - UiPath Community Forum

1 Like

Thanks bro for the solution

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.