Separate_values_contain_both_positive-and_negative_values

Hi guys,

I have a problem.

I have to make a report from a raw file where based on column name “Name” (i.e., ‘abc’) “Values” will be stored .

But first it is checking, whether ‘abc’ column value has both positive or negative value or not.

That’s why “def” & “jkl” column names are not present in “Output” . Since it contains only positive value or only negative value.

I have attached an excel.

Separate_only_positive_only_negative.xlsx (9.4 KB)

You can give your answer with UiPath logic or SQL query.

Thanks & Regards
Nirmalya

Hi @nirmalya.sarkar
can you elaborate a bit , better can you share us the expected output you require

we can try with LINQ

dtReport =

(From d in dtData.AsEnumerable
Group d by k=d("Name").toString.Trim into grp=Group
Let pc = grp.Any(Function (x1) CInt(x1("value").toString.Trim) >= 0)
Let nc = grp.Any(Function (x2) CInt(x2("value").toString.Trim) < 0)
Where pc AND nc
From g in grp
Order By dtData.Rows.IndexOf(g)
Select r=g).CopyToDataTable

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

@nikhil.girish ,

I have shared the Input and Output in an Excel file,

Please refer that.

Regards,
Nirmalya

Hi @nirmalya.sarkar

please find the example code of ur input and output
sequence.xaml (5.6 KB)

Thanks

@ppr , @nikhil.girish ,

Column name “Name” can be dynamic and the values also.

Then what to do??

have some visuals for further help
grafik

we can use variables within the statement and calculate the column index / name in advance

like this for example

strKeyCol = “Name”
strValCol = “value”

(From d In dtData.AsEnumerable
Group d By k=d(strKeyCol ).toString.Trim Into grp=Group
Let positive = grp.Any(Function (x1) CInt(x1(strValCol ).toString.Trim) >= 0)
Let negative = grp.Any(Function (x2) CInt(x2(strValCol ).toString.Trim) < 0)
Where positive And negative
From g In grp
Order By dtData.Rows.IndexOf(g)
Select r=g).CopyToDataTable
1 Like

Kindly go with the below explanation mentioned by PPR that works

Thanks

@ppr , @nikhil.girish ,

Thanks to both of you. It worked.

Regards
Nirmalya Sarkar

1 Like

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