COMPLEMENT() Forms the complement value of a data type ------------------------------------------------------------------------------ Syntax COMPLEMENT(<expValue>) --> xComplement Argument <expValue>[@] Designates any valid expression of any data type to form a complement value. Complement() only allows a character string to be passed by reference. Returns COMPLEMENT() returns the complement value that corresponds to the same data type for <expValue>. Description COMPLEMENT() returns the respective opposite value of the <expValue> parameter. In contrast to CHARNOT(), which only permits character strings, this function permits all data types. The result is the same data type as the parameter. For example, a date returns a date as a result. It corresponds to the difference between the indicated date and 12/31/2999. Note . COMPLEMENT(COMPLEMENT(<expValue>)) always returns <expValue> as output. Examples . The complement of a logical value corresponds to the use of .NOT.: ? COMPLEMENT(.T.) // .F. ? COMPLEMENT(.F.) // .T. . Numeric values change sign: ? COMPLEMENT(99) // -99.00 ? COMPLEMENT(0) // 0 ? COMPLEMENT(-99) // 99.00 ? COMPLEMENT(-9.9) // 9.90 ? COMPLEMENT(9.9) // -9.9 . With strings, the function works like CHARNOT: ? COMPLEMENT("123ABCabc") // " <157><156>" . The difference between 1/1/1900 and 01/01/3000: SET CENTURY ON ? COMPLEMENT(CTOD("01/01/00")) // 12/31/1099 . An empty or invalid date gives the same result -- 01/01/3000: SET CENTURY ON ? COMPLEMENT(CTOD(" / / ")) // 01/01/3000 ? COMPLEMENT(CTOD("77/77/77")) // 01/01/3000
See Also: Introduction