Navigation:  MCL Reference > Conversion Functions >

Cnv( )

Print this Topic Previous pageReturn to chapter overviewNext page

The function searches a list of items (cListToBeSearched) for an item (cToSearch) and returns another a string item at the same ordinal position from another list (cListOfReturnItems).

 

Syntax

Cnv(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 is the item.

cListOfReturnItems

List of items for returning. If the nth item in cListToBeSearched matches eToSearch, the nth item of cListOfReturnItems will be returned. If no match is found in cListToBeSearched, the function will return a value as follows:

IF the number of items in cListOfReturnItems is greater than the number of items 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 is 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

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

String "ee" will be returned.

 

Cnv('x','a,b,c','dd,ee,ff')

.Null. will be returned.

 

Cnv('x','a,b,c','dd,ee,ff,gg')

String "gg" will be returned.

 

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

String "hh" will be returned.

 

Cnv('RT','LF;RT','Left("Many",2);right("Many",2)',,';')

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

 

Cnv(y,'10,15,35','dd,ee,ff')

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

 

Cnv(y,'.T.,.F.','12,23','35')

IF y is true, the function returns "12". If y is false the function returns "23". If y is null, "35" will be returned.

 

Cnv(HrDate( ),'{^2000/1/1},{^2000/1/7},{^2000/1/14}','13,39,12')

If HrDate( ) is 14th Jan 2000, String "12" will be returned.

 

See also

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

 

 


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