cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
SadowSon
Level: Power Up

Need help with chopping a string down into a substring if it's greater than 255

Hey team

 

I'm trying to run this pile of code through Microsoft Flow. Access to the MS Form is fine and access to the MS Team is fine.

Long story short, if a string is more than 255 characters in length, I need to cut the string down to 255, ignoring anything cut off.

If I tell the code to always chop down to less than 255 from a string that's already less than 255, it crashes and burns.

If I tell the code to run an IF statement, as below, MS Flow refuses the expression saying that it's invalid.

 

The general format *appears* correct to me and when I run it through my VBA debugger, it says that it's fine - before I have the Dynamic Content part put in.

 

Any help would be greatly appreciated.

 

=IF(LEN((outputs('Get_response_details')?['body/r235f9d3840324a4d835cc30c351163bf'])>255),(LEFT((outputs('Get_response_details')?['body/r235f9d3840324a4d835cc30c351163bf']),255)),(outputs('Get_response_details')?['body/r235f9d3840324a4d835cc30c351163bf']))

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Need help with chopping a string down into a substring if it's greater than 255

 

Hi @SadowSon ,

 

Please refer to the follow expression:

 

Suppose I store the output of outputs ('Get_response_details')? ['Body / r235f9d3840324a4d835cc30c351163bf']) in Compose.

 

Then the expression I should use below should be:

if(greater(length(outputs('Compose')),25),take(outputs('Compose'),25),outputs('Compose'))

13.PNG

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Super User
Super User

Re: Need help with chopping a string down into a substring if it's greater than 255

@SadowSon 

Hi there.

So the functions in Power Automate use a slightly different syntax than Excel or other similar products.  You'll probably want to use a combination of Length(), Greater(), and maybe Substring() to accomplish this.  Check out the list of functions here, and see if any of those will work.

 

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.

Community Support Team
Community Support Team

Re: Need help with chopping a string down into a substring if it's greater than 255

 

Hi @SadowSon ,

 

Please refer to the follow expression:

 

Suppose I store the output of outputs ('Get_response_details')? ['Body / r235f9d3840324a4d835cc30c351163bf']) in Compose.

 

Then the expression I should use below should be:

if(greater(length(outputs('Compose')),25),take(outputs('Compose'),25),outputs('Compose'))

13.PNG

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

SadowSon
Level: Power Up

Re: Need help with chopping a string down into a substring if it's greater than 255

Hey team

 

Thank you very much, Barrys suggestion seems to have made it work.

 

Thanks for the help.

Helpful resources

Announcements
firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Solution Authors
Top Kudoed Authors
Users online (5,941)