cancel
Showing results for 
Search instead for 
Did you mean: 

Code stage/Utility that can combine first 2 lines and delete 3rd and 4th lines?

andrew_doman
Level 3
Hello, I was hoping for a bit of assistance. I am trying to manipulate some data. I get text and store it into a data item. It looks like so: -------------------------- 2 September 2017. Dated 19 August 2017 19 August 2017 --------------------------- I am trying to combine/join the first 2 lines so it looks like (2 September 2017) and delete the other 2 lines. All 4 lines are variable in value (always dates as text), and so I cannot simply remove the above text with replace function. I am sure there would be a visual basic/.net code that can achieve this outcome, however lack the knowledge myself. Regards Andrew
3 REPLIES 3

andrew_doman
Level 3
I have at least gotten rid of lines 3 and 4 with an instring looking for the ""."" and then obtained left -1 of that instring number value. Now just need to combine lines 1 and 2 with space between both lines (2 September 2017). I've heard there should be a regex utility available however in the development environment instance of BP I am working with it doesn't seem to be present.

Split text by line and then loop and then add text together.

OlaNykvist
Level 3
No need to use regex or code stage to solve this. Use a multi calculation stage with the following expressions (""Data"" is the name of the data item): Left([Data], InStr([Data], ""."")) and store result in Data - this removes line 3 and 4 Replace([Data], NewLine(), "" "") and store result in Data - the replaces the new line with a space