Crop text length

In the ForecastSales table I would like to add a method to return the first three characters of the Customer type (Dimension).

The field length is 10 characters but I want to return just the first three:


GEN01, GEN02, GEN03 would all return GEN

display Dimension dimension()
str CustDimTrim;

CustDimTrim = subStr(this.Dimension,1,3);

return CustDimTrim;


Access specific dimension value by using CustDimTrim = subStr(this.Dimension[1],1,3) // 1 is array index of the particular dimension which you can see in Dimension EDT.

ForecastSales _ ForecastSales ;
str CustDimTrim;
select _ ForecastSales where …(ur condition) ;

CustDimTrim = _ ForecastSales .Customertype ;
CustDimTrim = subStr(CustDimTrim,1,3);
return CustDimTrim;