October 17, 2001 

====================================================================
>From the Edge: Extending the use of new LISTOF function 
Section:                New Aggregate Function for SELECT command 
Chapter:                Running R:BASE Your Way! 
Platform:               R:BASE 2000 (ver 6.5++) for Windows
Build:                  1.843xRT03 and Higher 
====================================================================

With the introduction of new LISTOF aggregate function in R:BASE 
2000 (version 6.5++) for Windows, In-Line Patch-1, Build:1.843xRT03 
and higher, to be released shortly, now you can select more than 
one value in a text string.

The aggregate functions (COUNT, MAXIMUM, MINIMUM, and SUM) used 
in SELECT commands now have a new member of their family called 
"LISTOF" which creates a text string of the values separated by 
the current comma delimiter character. 

Syntax: 

At the R> Prompt or in a command file: 

Example 01.

SET VAR vValueList TEXT = NULL 
SELECT (LISTOF(ColumnName)) INTO vValueList INDIC IvValueList +
FROM TableName WHERE ... 

The variable vValueList will be a text string of the values 
separated by the current comma delimiter character. 

In a Form, Report or Label Expression: 

Example 02.

VariableName = (LISTOF(ColumnName)) IN LookUpTableView WHERE +
KeyColumn = KeyColumn 

At the R> prompt or in a command file, if you would like to 
add a single space after each value, then: 

Example 01A.

SET VAR vValueList TEXT = NULL 
SELECT (SRLP(LISTOF(ColumnName),',',', ',0)) INTO +
vValueList INDIC IvValueList FROM TableName WHERE ...

Notice the additional space after comma in ReplaceString.

If you would like the carriage return after each value, then: 

SET VAR vValueList TEXT = NULL
SELECT (SRLP(LISTOF(ColumnName),',',(CHAR(10)),0)) INTO +
vValueList INDIC IvValueList FROM TableName WHERE ... 

In a Form, Report or Label Expression, if you would like 
to add a single space after each value, then: 

Example 02A.

VariableName = (SRLP(LISTOF(ColumnName),',',', ',0)) IN +
  LookUpTableView WHERE KeyColumn = KeyColumn 

If you would like the carriage return after each value, then: 

VariableName = (SRLP(LISTOF(ColumnName),',',(CHAR(10)),0)) IN +
  LookUpTableView WHERE KeyColumn = KeyColumn 


Stay tuned for more ...

Very Best Regards,

Razzak.

===================================-============================
Official R:BASE List Server:    mailto:[EMAIL PROTECTED]
RBTI Events/Training:        http://www.rbase2000.com/events
R:DCC Members:               http://www.rbase2000.com/rdcc
================================================================
R:BASE, Oterro & R:Tango are registered trademarks of RBTI.
==================================-=============================

Reply via email to