0

I have a Linq query written in C#. I don't know how to change it so that it works with UiPath.

The query finds all AccountNumber in the table and finds the sum of Remainder rows

var afterChange = listDate.GroupBy(account => account.AccountNumber)
   .Select(group => new 
   {
      AccountNumber = group.Key,
      Сurrency = group.Select(groupElement => groupElement.Сurrency).First(),
      Remainder = group.Select(groupElement => groupElement.Remainder).Sum(),
   })
   .AsEnumerable()
   .Select(x => new TableData 
   {
      Remainder = x.Remainder,
      AccountNumber = x.AccountNumber,
      Сurrency = x.Сurrency
   })
   .ToList();
Svyatoslav Danyliv
  • 21,911
  • 3
  • 16
  • 32

1 Answers1

0

Not familiar with UiPath, but your query needs correction.

var afterChange = listDate.GroupBy(account => new { account.AccountNumber, account.Сurrency })
   .Select(group => new TableData
   {
      AccountNumber = group.Key.AccountNumber,
      Сurrency = group.Key.Сurrency,
      Remainder = group.Sum(x => x.Remainder),
   })
   .ToList();
Svyatoslav Danyliv
  • 21,911
  • 3
  • 16
  • 32