Remove the last 2 characters from a variable length string using the string's length - 2

Does anyone know how to use Truncate to remove the last 2 characters of a variable length string? I tried using Truncated to and then using the string number of characters - 2 but I could not get bubble to allow me to minus 2 from the string number of characters. I guess a simple way to put it is, I want to cut off the last 2 characters of a string no matter what size the string is.

Hi there, @tradersadvantage… try enabling the experimental parentheses feature on the Settings >> Version tab (although, I don’t think that should be necessary here), and then try configuring an expression that looks like this.

truncate

Also, what is the field type of the Tnum field? If it’s a number field, you might have a type mismatch on your hands.

Hope this helps.

Best…
Mike

Thanks for the quick response and I tried what you suggested but when I added the open parentheses bubble did not give me the option to pick the string name.
I’m not sure if it matters, but this is in a backend workflow.
image

Tnum is a text field.

Oh, I wouldn’t have expected that to be a backend workflow. Is there a particular reason you are doing a search for a user instead of sending the user as a parameter to the backend? Along that same line, try sending the truncated text as a parameter to use in the backend workflow.

The variable length string is from an incoming API webhook and the last 2 digits are unused. The search for user is just so I can locate the correct user to store the incoming data.

In your last screenshot, you might be clicking in the “wrong” area. The parentheses feature can be a bit tricky to use.

I just realized that. I started typing the function as I originally did and it gave me the option to minus 2 digits from the number of characters and it added the parentheses on it’s own. Thanks for your help!
image

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.