How to extract a left sub-string from a given string in Sage Enterprise Management?

By | May 23, 2017

In Sage X3, we may come across various scenarios where you need to get sub-string from an existing string. We can derive sub-string from both the ends i.e. From the Left and from the right or start from a particular position of a given string.

This blog will help us to extract the leftmost sub-string from a given string i.e. We can derive a sub-string with particular number character from the left of the given string.

Sage X3 provides the below special function to achieve the same: 

left$ (string,nb_char)

This function is used to extract a substring starting from the left-hand side first letter of an original string to the letter ending with the specified number of characters.


string -> Original string with the alphanumeric expression

nb_char -> Numerical integer expression for the length of a string to be extracted.

Let’s consider following example for Extraction of sub-string with 4 letters from left to better understand the working of left$ function.


Local Char YSTRING(50)


Infbox left$(YSTRING, 4)

The above snippet of code will give output as “JACK“.

Hope this helps!

About Us
Greytrix is one stop solution provider for Sage ERP and Sage CRM needs. We provide complete end-to-end assistance for your technical consultations, product customizations, data migration, system integrations, third-party add-on development and implementation expertise.

Greytrix has some unique solutions of Sage X3’s integration with Sage CRM,, and Magento eCommerce. It also offers best-in-class Sage X3 customization and development services to Sage business partners, end users, and Sage PSG worldwide.

For more information on Sage X3 Integration and Services, please contact us at We will be glad to assist you.