Make your own reusable RIGHT function to return a number of characters from the end of a text string

Sueann SeeSueann See Administrator
edited July 1 in Resources

A customer was asking if there is a way to achieve something similar to the RIGHT() function within Aperture Data Studio.

We do have a flexible Substring function that you can use.

  • Use -1 to indicate that the End position should be the last character of the Input value.
  • Specify any negative number to return a number of characters from the end of a text string. For example, -5 for the Start position indicates that you want to return the last 5 characters of the Input value.



If you find it difficult to remember to enter a negative number, you can make your own reusable RIGHT function. You only need to set this up once, and you will have a new RIGHT function that you can use over and over again.

  1. Create a new function. Set up parameters Number of Characters and Input Value.

2. Insert the Multiple and Substring functions as follows, with the parameters specified accordingly. The multiplier should be fixed as -1 and End Position also fixed as -1.

3. Select both the functions and click Make Reusable. Name the new function "RIGHT".


4. Create a new function. You will notice that there is now a "RIGHT" function that you have created which accepts an Input Value and a Number of Characters.

5. Test your new function to make sure it works as expected.


Hope this is useful for you.

Sign In or Register to comment.