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
Yoichi
(Yoichi)
December 12, 2024, 5:34am
2
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”}
Yoichi
(Yoichi)
December 12, 2024, 9:28am
4
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
Yoichi
(Yoichi)
December 12, 2024, 9:34am
6
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”}
Yoichi
(Yoichi)
December 12, 2024, 9:41am
8
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
Yoichi
(Yoichi)
December 12, 2024, 2:19pm
11
Hi,
Can you share exact input string as file using WriteTextFile activity?
Regards,