Please enable JavaScript to view this site.

R:BASE 11 Help

Navigation: Function Index > I

ITEMCNT

Scroll Prev Top Next More

(ITEMCNT('Text String'))

 

Use to count the number of items in a text string separated by a comma (or the current delimiter).

 

In the following example, the value of vItems is 3.

 

SET VAR vItems = (ITEMCNT('a,b,c'))

 

Here is an example of using this function in a command block to format a CHOOSE box:

 

SET VAR vModels TEXT = NULL

SET VAR vLines INTEGER = NULL

SET VAR vModel TEXT = NULL

SELECT (LISTOF(Model)) INTO vModels INDIC IModel FROM Product

SET VAR vLines = (ITEMCNT(.vModels))

IF vLines > 18 THEN

SET LINES = 18

ENDIF

CLS

CHOOSE vModel FROM #LIST .vModels AT 4 30 TITLE 'Choose Model' +

CAPTION 'Available Models' Lines .vLines FORMATTED

IF vModel IS NULL OR vModel = '[Esc]' THEN

GOTO Done

ENDIF

 

-- Do what you have to do here ...

 

LABEL Done

CLEAR ALL VAR

QUIT TO MainMenu.RMD

RETURN