CHOOSE()
From Lianjapedia
Revision as of 11:59, 26 September 2019 by Yvonne.milne (Talk | contribs)
Contents
Purpose
Function to return from a list the expression at the specified position
Syntax
CHOOSE(<expN>,<exp1>[,<exp2>...])
See Also
AGGREGATES, AT(), ATNEXT(), CHARINDEX(), CLEAR SMARTQUERY, CREATE CURSOR, CREATE TABLE, EXPLAIN, FETCH, INLIST(), JavaScript built-in Lianja/VFP functions, INSERT, LEFT(), LIKE(), LOOKUP(), OCCURS(), OPERATORS, PREDICATES, PSEUDO COLUMNS, RAT(), RIGHT(), RLOOKUP(), SET SMARTQUERY, SET SQLROWID, SET XMLFORMAT, STR(), STREXTRACT(), STRTRAN(), STUFF(), SUBSTR(), SYSTEM TABLES, UPDATE
Description
The CHOOSE() function returns the expression at the specified position from the specified list. The position is represented by <exp1>. Expressions following <expN> make up the list in which the CHOOSE() function will return the specified argument.
Example
? choose(2,"One","Two","Three") Two open database southwind select employeeid, hiredate,CHOOSE(MONTH(HireDate),'Winter','Winter', ; 'Spring','Spring','Spring','Summer','Summer','Summer','Autumn','Autumn',; 'Autumn','Winter') AS Quarter_Hired from employees EMPLOYEEID HIREDATE QUARTER_HIRED 1 09/08/2011 Autumn 2 08/14/1992 Summer 3 09/08/2011 Autumn 4 05/03/1993 Spring 5 10/08/1993 Autumn 6 10/17/1993 Autumn 7 01/02/1994 Winter 8 03/05/1994 Spring 9 11/15/1994 Autumn