cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jpsimmonds_au
New Member

Find and split text (email body) at newline before hard limit

I am hoping for a little guidance here as I am at a loss as to how to achieve this in Flow/Power Automate rather than in straight code.

 

I have an email coming in that may be small at lets say 10,000 characters or large at lets say 350,000 characters (its an automated change email) which then needs to be processed into a system (Slack) that has a 100,000 character hard limit input (but I can simply drop 4 lots of text straight one after the other in this example and it will get processed correctly).

 

Checking to see if the email message is under the 100,000 character limit and processing if not is straight forward, however to process those over the 100,000 character limit I need to split the text and run it using a loop which is fine but I need to split the text at the new line character that is some characters prior to the 100,000 limit. Remember that position, paste the extracted portion of the text into slack, using that position again to the check (if remainder of the text is still longer than the 100,000 charater limit and if is), split, post sequence until there is no text left

 

Thoughts? Obviously a loop is going to be involved and a couple of variables its more the finding and splitting of the text at the correct place that has me stumped

2 REPLIES 2
edgonzales
Super User
Super User

@jpsimmonds_au 

Hi there.  So, here's an idea:

 

  • When you use the Split() function on a string, it converts that string to an array with multiple segments (or elements). 
  • You could then use an "Apply to Each" loop to work through each element of that array.
  • If this works with the smaller ones (<100k), then you can lose the condition and just treat all blocks the same (Adding to Slack at each new line character).

Hopefully, that helps.

Keep us posted.

-Ed

 

If you liked this reply, please give it a thumbs up! If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

Thanks @edgonzales I did not think of that, much simpler, I will give that a shot

 

Justin

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (2,969)