I would like to write this data to another datatable DT2 containing column1 only uniquevalues and column 2 as their count in first datatable and column 3 as sum of corresponding values of duplicate elements from DT1.i want to do above using counters.
I am attaching my example I don’t know where I am wrong I am not getting required count.
Countexample.xaml (11.0 KB) Example2.xlsx (8.6 KB)
Thanks in advance…
Above I have posted pic of required output
@ppr I have posted pic of expected output…
Thanks in advance
@Gattu_Monika
find starter help here:
GroupBy_1Col_Report_Member-CounfSum.xaml (9.0 KB)
sample is working on a similar, reduced datat set, is showcasing the same task.
I had a look on your implementation. Just have a look here, show casing on we can simulate a group by Linq with essential uipath activities
GroupBy_DistinctFilter_Pattern.xaml (11.7 KB)
@ppr Thank you so much…It worked very well.
But can you please give me an idea how to do it without linq and using for each loops. I am not aware of linq so it would be great help if you could help me with loops.
Thanks
Monika
Sure, have a look on already provided second xaml. It is doing it.
Have close look on the log message whre it is logging the group count (it is similar to your output second column)
in the same manner we can produce the sum as well.
Give a try on it. In case of open question I will guide you and complete it with you
ok …I will try it.
Thanks @ppr
Hi @ppr
when i used first method it worked well in one process.when i am trying to use in other process i am getting below error.
Conversion from string “” to type ‘Integer’ is not valid. —> RemoteException wrapping System.FormatException: Input string was not in a correct format.
Can you please help me with this.
Thanks
Monika
in general this message comes from string values that are not representing an integer value like:
“ABC3”, empty string
on a first step just check the data on this. Maybe you can find the invalid values with following:
go and debug
readin datatable and stop after this with a breakpoint
open immediate panel
type in following statement:
datatableVar.asEnumerable.Select(Function ( r ) r(YourColumnNameOrIndex).toString).Where(Function (x) Not Int32.TryParse(x,nothing)).toArray
find some analysis demo here:
FindInDT_NoNValidDigitStrings.xaml (6.9 KB)
Ok @ppr
I will try it…
Thanks
@Gattu_Monika
focus on empty strings as often this is the issue in the majority of cases
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.