Page tree

Trifacta Dataprep



Contents:

If you licensed Dataprep by Trifacta before Oct. 14, 2020, you are using the Dataprep by Trifacta Legacy product edition. On October 14, 2022, this product edition will be decommissioned by Google and will be no longer available for use. Current customers of this product edition are encouraged to transition to one of the product editions hosted by Trifacta. See Product Editions.

   

Returns true if either argument evaluates to true. Equivalent to the || operator.
  • Each argument can be a literal Boolean, a function returning a Boolean, or a reference to a column containing Boolean values.

Since the function returns a Boolean value, it can be used as a function or a conditional.

NOTE: Within an expression, you might choose to use the corresponding operator, instead of this function. For more information, see Logical Operators.

Wrangle vs. SQL: This function is part of Wrangle , a proprietary data transformation language. Wrangle is not SQL. For more information, see Wrangle Language.

 

Basic Usage

or(daysBillOverdue > 90, violationsCount > 2)

Output: If the value in the daysBillOverdue column is greater than 90 or the value in violationsCount column is greater than 2, then the returned value is true. Otherwise, the value is false

Syntax and Arguments

or(value1, value2)


ArgumentRequired?Data TypeDescription
value1YstringThe first value must be a Boolean literal, column reference, or expression that evaluates to true or false.
value2YstringThe first value must be a Boolean literal, column reference, or expression that evaluates to true or false.

For more information on syntax standards, see Language Documentation Syntax Notes.

value1, value2

Expressions, column references or literals to compare as Boolean values.

  • Missing or mismatched values generate missing results.

Usage Notes:

Required?Data TypeExample Value
YesFunction or column reference returning a Boolean value or Boolean literalmyHeight > 2.00


Examples

Tip: For additional examples, see Common Tasks.

Example - Logical Functions

This example demonstrate the ANDOR, and NOT logical functions.

In this example, the dataset contains results from survey data on two questions about customers. The yes/no answers to each question determine if the customer is 1) still active, and 2) interested in a new offering.

Functions:

ItemDescription
AND Function Returns true if both arguments evaluate to true. Equivalent to the && operator.
OR Function Returns true if either argument evaluates to true. Equivalent to the || operator.
NOT Function Returns true if the argument evaluates to false, and vice-versa. Equivalent to the ! operator.

Source:

CustomerisActiveisInterested
CustAYY
CustBYN
CustCNY
CustDNN

Transformation:

Customers that are both active and interested should receive a phone call:

Transformation Name New formula
Parameter: Formula type Single row formula
Parameter: Formula AND(isActive, isInterested)
Parameter: New column name 'phoneCall'

Customers that are either active or interested should receive an email:

Transformation Name New formula
Parameter: Formula type Single row formula
Parameter: Formula OR(isActive, isInterested)
Parameter: New column name 'sendEmail'

Customers that are neither active or interested should be dropped from consideration for the offering:

Transformation Name New formula
Parameter: Formula type Single row formula
Parameter: Formula AND(NOT(isActive),NOT(isInterested)
Parameter: New column name 'dropCust'

A savvy marketer might decide that if a customer receives a phone call, that customer should not be bothered with an email, as well:

Transformation Name Edit column with formula
Parameter: Columns sendEmail
Parameter: Formula IF(phoneCall == "TRUE", FALSE, sendEmail)

Results:

CustomerisActiveisInteresteddropCustsendEmailphoneCall
CustAYYFALSEFALSETRUE
CustBYNFALSETRUEFALSE
CustCNYFALSETRUEFALSE
CustDNNTRUEFALSEFALSE

See Also for EXAMPLE - Logical Functions:

 

This page has no comments.