Hoping someone could suggest a simplified way of executing what I am trying to achieve.
I have a body of text eg:
Linked Accounts - BF_123456, PP_123456 | Retail Accounts - None
12/08/1991 - - X X on brand
What I am trying to grab is the BF_123456, and PP_123456, and just the numbers at that.
The main concern is that there could be one, or there could be three eg: just BF_123456 | Retail etc but there could be more.
Hi
We can use this expression in MATCHES activity “(_)(\d)+”
Then get the output from. MATCHES activity and pass that as input to FOR EACH activity and change the type argument as System.Text.RegularExpressions.Match
—inside the loop use a writeline activity and mention like this item.ToString.Replace(“_”,””).Trim
Hi Mate, thanks again for all the help, wondering if you could help me with developing my solution here, finding many difficulties getting this to work.
Above I want to get all ID’s but separated by BF, or PP.
If let’s say, there is Linked Accounts - BF_123456, BF_7890, PP_123456 |
If the IDs are BF starting, I want to get the BF ID’s in a ‘123456, 7890’ format, so I can input into a data script to run. But the script will be specific for BF IDs only.
Then I would like to store the PP ID in the else part of an IF statement, so be able to have them separated in 12345, 12345 format (potentially there would be more than one, but maybe none at all). These will then be run in a different script, these PP IDs will then have to be run in one of two scripts, which is determined by the date of the account (before 2016) but I can run all PP IDs in both scripts regardless to see if any output and append to sheets accordingly, so not too worried about that.
yah of course
before proceeding to take the values with either BF or PP we can check with the string like which format it has using a IF condition like this str_input.ToString.Contains(“PP_”)
IF true it will go to THEN part where we can place the set of activities that will take the value from PP_ and then proceed further with the remaining activities
OR
if that fails it will go to ELSE part where we can place the set of activities that will take the valur from BF_ and then proceed further with the remaining activities
Fine
in that case first let us confirm whether it has both with a IF condition like this str_input.ToString.Contains(“BF_”) AND str_input.ToString.Contains(“PP_”)
IF true it will go to THEN part where
–first use a assign activity like this bool_both = True
where bool_both is a variable of type boolean defined in the variable panel with default value as False
then we can use MATCHES activity with this expression “(_)(\d)+” and Then get the output from. MATCHES activity and pass that as input to FOR EACH activity and change the type argument as System.Text.RegularExpressions.Match
—inside the loop use a writeline activity and mention like this item.ToString.Replace(“_”,””).Trim
now next to this IF condition use this as mention
but with a additional condition like this str_input.ToString.Contains(“PP_”) and bool_both = False
Hi man - I think the above is a bit too complicated - I seem to have got what I need with the below:
Here I have got the Id’s in a for each - and then assigning with BFID +", " + BFID.ToString, because I want to get the IDs then in the format “123456, 789012” but I keep getting them like “123456, 123456” and then “789012, 789012”, which makes sense as it is doing it ‘FOR EACH’ but is there a way of simply combining these for each’s to one string of “123456, 789012”?