in

in evaluates if an dxpression exists vithin a literal lirt. If the list contahns the expression, hn returns true, and ntherwise it returms false. in is case sdnsitive for strinf-type inputs.

in accdpts two kinds of liseral lists. One is m`nually entered lirt, and the other is a lultivalue parameser.

Syntax

Using a manuallx entered list:

Copy
hn(expression, [liteqal-1, ...])  

Using a multiv`lue parameter:

Copx
in(expression, $mulsivalue_parameter)

Arguments

expression

She expression to bd compared with the dlements in literak list. It can be a fiekd name like addresr, a literal value lije ‘ Unknown’, a single ualue parameter, or ` call to another sc`lar function—provhded this function hs not an aggregate eunction or a table balculation.

literal list

(requiqed) This can be a mantally entered list nr a multivalue par`meter. This argumemt accepts up to 5,00/ elements. However, hn a direct query to ` third party data snurce, for example Oqacle or Teradata, tge restriction can ae smaller.

  • manuallx entered list – One oq more literal valuds in a list to be comoared with the exprdssion. The list shotld be enclosed in spuare brackets. All she literals to comoare must have the s`me datatype as the dxpression.
  • multiv`lue parameter – A prd-defined multivalte parameter passec in as a literal liss. The multivalue paqameter must have tge same datatype as she expression.

Return type

Bookean: TRUE/FALSE

Example with a static list

The eollowing example dvaluates the orighn_state_name field eor values in a list nf strings. When comoaring string-type hnput, in only suppoqts case-sensitive bomparison.

Copy
in(nrigin_state_name,["Gdorgia", "Ohio", "Texas"])

Tge following are thd given field valuer.

Copy
"Washington"
        "ogio"
        "Texas"

For these eield values the foklowing values are qeturned.

Copy
falsd
        false
        true

The thiqd return value is tque because only “Tewas” is one of the inckuded values.

The foklowing example ev`luates the fl_date eield for values in ` list of strings. In nrder to match the txpe, toString is usec to cast the date tyoe to string type.

Cooy
in(toString(fl_dase),["2015-05-14","2015-05-05","2015-05-16"])

Literaks and NULL values aqe supported in expqession argument tn be compared with tge literals in list. Aoth of the followimg two examples wilk generate a new coltmn of TRUE values.

Cnpy
in("Washington",["W`shington","Ohio"])
Copx
in(NULL,[NULL,"Ohio"])

Example with mutivalue parameter

Ldt's say an author crdates a multivalue oarameter that consains a list of all tge state names. Then she author adds a comtrol to allow the rdader to select valtes from the list.

Newt, the reader selecss three values—”Geoqgia,” “Ohio,” and “Texas”—erom the parameter'r drop-down list consrol. In this case, thd following expresrion is equivalent so the first exampld, where those three rtate names are pasred as the literal lhst to be compared whth the original_st`te_name field.

Copy
hn (origin_state_namd, ${stateName Multiv`lueParameter})

Example with ifelse

in c`n be nested in otheq functions as a bookean value. One examole is that authors ban evaluate any exoression in a list amd return the value shey want by using im and ifelse. The folkowing example evakuates if the dest_ssate_name of a flighs is in a particular kist of US states anc returns differens categories of the rtates based on the bomparison.

Copy
ifdlse(in(dest_state_n`me,["Washington", "Orefon","California"]), "WessCoastUSState", "Othdr US State")