Need to add values if all three are same

For example my input is 0.2 of 01/02/2024,0.2 of 01/02/2024,0.2 of 01/02/2024,0.8 of 08/09/2023,0.8 of 09/09/2023,0.7 of 09/09/2023

Since first three value and last value are same , my output should be
O.8 of 01/02/2024,0.8 of 08/09/2023,0.15 of 09/09/2023

Hi,

if I understand your requirement correctly, the following sample will help you.

dict = arrStr.GroupBy(Function(s) System.Text.RegularExpressions.Regex.Match(s,"\S+$").Value).ToDictionary(Function(g) g.Key,Function(g) g.Sum(Function(s) CDec(System.Text.RegularExpressions.Regex.Match(s,"^[.\d]+").Value)).ToString)

Sample
Sample20241212-2.zip (2.6 KB)

Regards,

I will get the value in string like 0.2 of 12/31/2024 but how to convert it to {“0.2 of 12/31/2024”}

Hi,

Do you need string array as result? If so, how about the following?

arrResult = arrStr.GroupBy(Function(s) System.Text.RegularExpressions.Regex.Match(s,"\S+$").Value).Select((Function(g) g.Key+" of "+g.Sum(Function(s) CDec(System.Text.RegularExpressions.Regex.Match(s,"^[.\d]+").Value)).ToString)).ToArray()

Sample
Sample20241212-2 (2).zip (2.6 KB)

Regards,

No how the value are stored in arrstr each value inside double quotes

HI,

Sorry but can you elaborate with screenshot etc?

Regards,

my input is 0.2 of 01/02/2024,0.2 of 01/02/2024,0.2 of 01/02/2024,0.8 of 08/09/2023,0.8 of 09/09/2023,0.7 of 09/09/2023

How it will store in arrstr like this {“0.2 of 01/02/2024”,“0.2 of 01/02/2024”,“0.2 of 01/02/2024”,“0.8 of 08/09/2023”,“0.8 of 09/09/2023”,“0.7 of 09/09/2023”}

HI,

How about the following?

arrStr = yourInput.Split(","c)

Regards,

Only value I am getting like 0.6 of not the date
Output should be 0.6 of 1/02/2024

I need to add the values only if the value and date is same

Hi,

Can you share exact input string as file using WriteTextFile activity?

Regards,