SSUB
Top  Previous  Next

(SSUB(text,n))

Captures substring number n from text, returning a text string. Substrings in text are separated by a comma (or the current delimiter).

The SSUB function is often used with the CHOOSE command when capturing menu options from a pull-down menu.

In the following example, the value of vssub is yearend.

SET VAR vtext = 'reports,yearend'  
SET VAR vssub = (SSUB(.vtext,2))  
 
The following example shows that SSUB separates items based on a blank rather than the current delimiter when n is less than zero.

SET VAR vtext = 'reports yearend'  
SET VAR vssub2 = (SSUB(.vtext,-2))  
 
The following example also returns yearend. For this example, assume that twodim is a bar with a pull-down menu with the options Edit and Enter stored as text numbers according to their positions on the menu. The pop-up menu for both options contains a list of form names, so the second item in the CHOOSE variable will be a form name.

CHOOSE vtwodim FROM twodim  
SET VARIABLE vbar = (SSUB(.vtwodim,1))  
SET VARIABLE vpull = (SSUB(.vtwodim,2))  
IF vbar = '1' THEN  
EDIT USING .vpull  
ELSE  
ENTER .vpull  
ENDIF