Navigation:  MCL Reference > Conversion Functions >

GCnv( )

Print this Topic Previous pageReturn to chapter overviewNext page

The function searches a list of items (cListToBeSearched) for an item equal to or greater 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 greater than cToSearch is found, all the following items will be ignore, the corresponding item in cListOfReturnItems will be returned.

 

Syntax

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

 

eToSearch

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

cListToBeSearched

List of items for searching (matching). The items in the list must be from small to large. 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. If the nth item in cListToBeSearched matches eToSearch, the nth item of cListOfReturnItems will be returned. If no in cListToBeSearch is equal to or greater 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

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

String "ee" will be returned.

 

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

String "ee" will be returned.

 

GCnv('y','s,t,x','dd,ee,ff')

.Null. will be returned.

 

GCnv('y','s,t,x','dd,ee,ff,gg')

String "gg" will be returned.

 

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

String "hh" will be returned.

 

GCnv('RA','LT;RF','Left("Many",2);Right("Many",2)',,';')

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

 

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

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

 

GCnv(HrDate( ),'{^2000/1/2},{^2000/1/8},{^2000/1/14}','13,39,12')

If HrDate( ) returns 1st Jan 2000, String "13" will be returned.

 

See also

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

 

 


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