Navigation:  MCL Reference > Conversion Functions >

SCnv( )

Print this Topic Previous pageReturn to chapter overviewNext page

The function searches a list of items (cListToBeSearched) for an item equal to or smaller than the first argument (cToSearch) and returns another a string item at the same ordinal position from another list (cListOfReturnItems). Search will be carried out from left to right. Once an item equal to or smaller than cToSearch is found, all the following items will be ignore, the corresponding item in cListOfReturnItems will be returned.

 

Syntax

SCnv(eToSearch,cListToBeSearched,cListOfReturnItems,cNullSearchReturn,cSeperator)

 

eToSearch

String to be searched. eToSearch can be of any data type

cListToBeSearched

List of items for searching (matching). If eToSearch is not of character type, the function will convert each member item of cListToBeSearched into the same data type before comparing. Please don't put any space after each comma. Otherwise the space will be regarded as a character of the item.

cListOfReturnItems

List of items for returning. The items in the list must be from large to small. If the nth item in cListToBeSearched matches eToSearch, the nth item of cListOfReturnItems will be returned. If no in cListToBeSearch is equal to or smaller than eToSearch, the function will return a value as follows:

IF the items in cListOfReturnItems are more than that in cListToBeSearched, the first excess item of cListToBeSearched will be returned.
Otherwise, .Null. will be returned.

Please don't put any space after each comma. Otherwise the space will be regarded as a character of the item.

cNullSearchReturn

If a .Null. value is passed into eToSearch, the function will return the value of cNullSearchReturn. However, if cNullSearchReturn is empty, .NULL. will be returned.

cSeparator

The default list item separator is comma (,), you may change the separator by passing a string into cSeparator.

 

Returns

Character

 

Examples

SCnv('b','a,b,c','dd,ee,ff')

String "dd" will be returned.

 

SCnv('j','q,k,c','dd,ee,ff')

String "ff" will be returned.

 

SCnv('a','x,t,s','dd,ee,ff')

.Null. will be returned.

 

SCnv('a','x,t,s','dd,ee,ff,gg')

String "gg" will be returned.

 

SCnv(.Null.,'c,b,a','dd,ee,ff','hh')

String "hh" will be returned.

 

SCnv('RT','RF;LT','Left("Many",2);Right("Many",2)',,';')

String 'Right("Many",2)' will be returned.

 

SCnv(y,'35,15,3','dd,ee,ff')

If y=10, String "ff" will be returned.

 

SCnv(HrDate( ),'{^2000/1/21},{^2000/1/18},{^2000/1/14}','13,39,12')

If HrDate( ) is 30th Jan 2000, String "13" will be returned.

 

See also

Cnv( ) | GCnv( ) | ListItem( ) | RListItem( ) | Conv( ) | SConv( ) | GConv( ) | IIF( )

 

 


Page url: http://www.racematenet.com/english/help/index.html?scnv.htm