@Amapola188 I've created a manual trigger flow with Compose actions to demonstrate.
Get the Length of the Original Text String
I used a Compose action to store a text string.

Add another Compose action after it to store the length of your text string. Insert and expression and use the length() function.

Click the dynamic content tab and insert the outputs (or dynamic content) that contains your original text string. I'm using the outputs from the Compose action above.


Compose a New Text String
You'll need to insert an expression to compose the new text string. You will need to replace the content i've indicated with square brackets (the square brackets will also need to be removed.

if(
greater([output from Compose action storing original text string length], 34),
substring([original text string], 0, lastIndexOf(substring([original text string], 0, 35), ' ')),
[original text string]
)
Explanation below.
if(
greater(length([output from Compose action storing original text string length]), 34), // Check if string length is greater than 34
substring(
[original text string],
0,
lastIndexOf(
substring([original text string], 0, 35), // Get the first 35 characters of the string
' ' // Find the last space in the first 35 characters
)
), // If greater than 34 characters, split at last space before 35th character
[original text string] // If 34 characters or less, return the whole string
)
Count New Text String
Add another Compose action (optional) to count the new text string length.

Run a test!


Hope this helps!
If I helped you solve your problem—please mark my post as a solution ✅. Consider giving me a 👍 if you liked my response!
|