Hello,
I am extracting data into a data table. One of the fields contains variable pieces of information
.
It could be:
CO-45: $40.88 , CO-253: $1.59 PR-2: $19.82
or it could be: CO-45: $40.88 , CO-253: $1.59
or:
CO-45: $139.41
There can be a different number of CO codes and of PR codes, but they are all listed in one field.
Part of the goal is to sum all the CO codes values and compare the sum with another value I have.
Currently I am using REGEX expressions to get up to 2 CO codes and one PR and assign them to variables. If the value is null then I assign 0.
Once I run into a different scenario, then of course Regex is not going to work as expected.
In your experience, is there a better way to handle the string so that it could correctly grab all the CO codes and PR codes no matter how many there are and (possibly using a loop and counter) assign them to variables like CO1code, CO2code, etc…
Or better yet, a way to grab all the values associated to however many CO codes, add them and save the sum to a single COSum variable.
Thank you all!