Function SUBSTR Explained

NOMAD/UltraQuest SUBSTR Function Explained

SUBSTR - Substring function - extracts a portion (substring) of a character/alphanumeric value but cannot be used with numeric data.

Let’s say you have a field called PRODUCT_CODE and it is an A5 field, alphanumeric 5 positions long.

Sample Values:

  • A5C00
  • A6D00
  • A7C00
  • B5C00
  • B7D00
  • C5E00

You want to display or maybe screen on the 3rd position of the field.  This is where the SUBSTR function comes in handy.

You build a DEFINE or expression using SUBSTR



  • itemname = the name of the ITEM or maybe an earlier DEFINE
  • S = the starting position in the field, in our example 3 or 3rd position
  • L = the length or number of positions you want, in our example 1 or only 1 position

Now if you include MY_CODE as a column you only get the third position or you can now easily screen stating MY_CODE eq ‘D’ and only get the PRODUCT_CODEs where the 3rd position is equal to ‘D’.

EFFICENCY NOTE:  Let’s say you only want to display or screen on the first position of PRODUCT_CODE rather than use SUBSTR you can simply do the following:

This will only use the first position of PRODUCT_CODE

Please feel to contact support if you have any additional questions about the SUBSTR function.