Skip to main content

CONV clause

Converts the value for a field using conversion codes.

Synopsis

field CONV "code"

Description

The CONV and CONVERSION keywords are synonyms.

The CONV clause converts the value(s) for the preceding field based on the value of code. This code is character code, specified as a quoted string, that specifies the type of conversion to perform. Conversion is from internal format to external format.

The conversion code values are the same as those used in the MVBasic OCONV function, where they are described in detail. For a complete list of conversion codes, refer to the Conversion Codes table in the MultiValue Basic Quick Reference.

Examples

The following example returns two columns: item names as stored in the VOC, and these item names converted to lowercase letters:

LIST VOC @ID CONV "MCL"

The following MultiValue Basic example creates an I-type field IPCT the value of which is calculated from the values of the fields PRICE and DSCPRICE:

0001 EXECUTE 'CREATE-FILE MYTESTFILE 1 1' CAPTURING STUFF 
0005 OPEN 'DICT','MYTESTFILE' TO DICT.FP ELSE ABORT 
0006 OPEN 'MYTESTFILE' TO FP ELSE ABORT 
0007 WRITE '100':@AM:'50' ON FP,3 
0008 WRITE '197':@AM:'175' ON FP,2 
0009 WRITE '203':@AM:'180' ON FP,1 
0010 
0011 WRITE 'D':@AM:1:@AM:@AM:'PRICE':@AM:'10R' ON DICT.FP,'PRICE' 
0012 WRITE 'D':@AM:2:@AM:@AM:'DSCPRICE':@AM:'10R' ON DICT.FP,'DSCPRICE' 
0013 WRITE 'I':@AM:\(TOTAL(PRICE-DSCPRICE))*100/TOTAL(PRICE)\:@AM:'MR20':@AM:'IPCT':@AM:'10R' ON DICT.FP,'IPCT' 

Using the above data, the following example converts the display of PRICE and DSCPRICE to dollar values with two fractional digits:

LIST MYTESTFILE TOTAL PRICE CONV "MR2$" TOTAL DSCPRICE CONV "MR2$" CALC IPCT
FeedbackOpens in a new tab