Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space DEV and version r0811

D toc

Excerpt

Returns list of all values in a column for rows that match a specified condition.


Info

NOTE: When added to a transformation, this function is applied to the current sample. If you change your sample or run the job, the computed values for this function are updated. Transformations that change the number of rows in subsequent recipe steps do not affect the values computed for this step.

To perform a simple extraction of values without conditionals, use the LIST function. See LIST Function.

D s lang vs sql

D s
snippetBasic

D lang syntax
RawWrangletrue
Typeref
showNotetrue
WrangleTextpivot value: listif(hotChocolateLiters, 500, temperature < 0) group:date limit:1

listif(hotChocolateLiters, 500, temperature < 0)

Output: Returns the values from the hotChocolateLiters column when the temperature value is less than 0. Maximum number of values is 500. 

D s
snippetSyntax

D lang syntax
RawWrangletrue
Typesyntax
showNotetrue
WrangleTextpivot value:listif(col_ref, limit, test_expression) [group:group_col_ref] [limit:limit_count]

listif(col_ref, limit, test_expression) [group:group_col_ref] [limit:limit_count]


ArgumentRequired?Data TypeDescription
col_refYstringReference to the column you wish to evaluate.
limit_intNintegerMaximum number of values to extract into the list array. From 1 to 1000.
test_expressionYstringExpression that is evaluated. Must resolve to true or false

D s lang notes

For more information on the group and limit parameters, see Pivot Transform.

col_ref

Name of the column whose values you wish to use in the calculation. Column must be a numeric (Integer or Decimal) type.

D s
snippetusage

Required?Data TypeExample Value
YesString that corresponds to the name of the columnmyValues

limit_int

Non-negative integer that defines the maximum number of values to extract into the list array. 

Info

NOTE: If specified, this value must between 1 and 1000, inclusive.

Info

NOTE: Do not use the limiting argument in a LISTIF function call on a flat aggregate, in which all values in a column have been inserted into a single cell. In this case, you might be able to use the limit argument if you also specify a group parameter. Misuse of the LISTIF function can cause the application to crash.

test_expression

This parameter contains the expression to evaluate. This expression must resolve to a Boolean (true or false) value.

D s
snippetusage

Required?Data TypeExample Value
YesString expression that evaluates to true or false(LastName == 'Mouse' && FirstName == 'Mickey')


D s
snippetExamples

Example - ANYIF and LISTIF Functions

Include Page
EXAMPLE - LISTIF Functions
EXAMPLE - LISTIF Functions

D s also
labelaggregate