cancel
Showing results for 
Search instead for 
Did you mean: 

How to Delete to the right of a word

ChristopherBerr
Level 3
Hi, 

I am working on a process that saves email attachments and one issue I am struggling with is the png being downloaded as well. I want to avoid doing that, by removing that Attachment in the Collection.attachment field. 

In the Collection, I get this attachment string:

Test.pdf|image001.png


I want to remove everything to the right of the | in the collection. 

Any help is greatly appreciated!

------------------------------
Christopher Berry
------------------------------
6 REPLIES 6

david.l.morris
Level 15
There are several ways to do that, so here's one. Assuming you assign that text into a data item called [textDataItem], then something like this should work. This of course assumes there is only one pipe in the string.

Right([textDataItem],Len([textDataItem])-InStr([textDataItem],"|"))


------------------------------
Dave Morris
3Ci at Southern Company
Atlanta, GA
------------------------------

Dave Morris, 3Ci at Southern Company

Thanks Dave! This is actually very close to what I need. I just need the PDF name. The code you gave gives me the png name. 


Worked on the First one but  failed on CompanyName.pdf|Image1.png as it only returns image1.png

------------------------------
Christopher Berry
------------------------------

Are you saying there could be any list of PDF files/PNG files/etc.? I wasn't paying attention before that this is from the Outlook VBO. If that's the case, you could do some RegEx here, but maybe the easiest way is to use the Utility - Strings object's action "Split Text" with "|" as the delimiter and then loop over the collection and remove rows that do not end in PDF, PNG, etc. or whatever files you want to keep vs not keep.

I keep editing this message because I realized I read over your messages too quickly. I'm distracted hahaha.

------------------------------
Dave Morris
3Ci at Southern Company
Atlanta, GA
------------------------------

Dave Morris, 3Ci at Southern Company

Hi @ChristopherBerr

I think the split text @Dave Morris mentioned is what you are looking for as this will list the attachments in a collection using | as the delimiter then using a loop you can pick and choose the ones you want to save to a folder. Another option would be to just save all the attachments then using Utility - File Management you can get a list of the png files in the download folder and using a loop can delete each of these from the folder.

Hope this helps :)​​

------------------------------
Michael ONeil
Technical Lead developer
NTTData
Europe/London
------------------------------

Agree with the above responses. Adding my small bit here with some snaps for reference.
30768.png
30769.png

------------------------------
If I was of assistance, please vote for it to be the "Best Answer".

Thanks & Regards,
Tejaskumar Darji
Sr. Consultant-Technical Lead
------------------------------

Hello @ChristopherBerr  - image001.png is coming to due embedded image like signature and company logo.

This has been in-corporate in latest VBO available on DX 2-3 days before by @ewilson. Please use the latest MS outlook VBO from dx.

https://digitalexchange.blueprism.com/dx/entry/3439/solution/ms-outlook-vbo


Flag action in save attachments will control the saving of these kind of attachment. I  have tested it and working fine for me.

30772.png​​

------------------------------
Neeraj Kumar
Technical Architect
------------------------------