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 next
Excerpt

This example demonstrate

...

the AND, OR, 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:

D generate list excerpts
pagesAND Function, OR Function, NOT Function

Source:

CustomerisActiveisInterested
CustAYY
CustBYN
CustCNY
CustDNN

TransformTransformation:

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

d-
code
trans
RawWrangletrue
p03Value'phoneCall'
Typestep
WrangleTextderive type:single value:AND(isActive, isInterested) as:'phoneCall'
p01NameFormula type
p01ValueSingle row formula
p02NameFormula
p02ValueAND(isActive, isInterested)
p03NameNew column name
SearchTermNew formula

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

d-
code
trans
RawWrangletrue
p03Value'sendEmail'
Typestep
WrangleTextderive type:single value:OR(isActive, isInterested) as:'sendEmail'
p01NameFormula type
p01ValueSingle row formula
p02NameFormula
p02ValueOR(isActive, isInterested)
p03NameNew column name
SearchTermNew formula

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

d-
code
trans
RawWrangletrue
p03Value'dropCust'
Typestep
WrangleTextderive type:single value:AND(NOT(isActive),NOT(isInterested) as:'dropCust'
p01NameFormula type
p01ValueSingle row formula
p02NameFormula
p02ValueAND(NOT(isActive),NOT(isInterested)
p03NameNew column name
SearchTermNew formula

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

d-
code
trans
RawWrangletrue
Typestep
WrangleTextset col:sendEmail value:IF(phoneCall == "TRUE", FALSE, sendEmail)
p01NameColumns
p01ValuesendEmail
p02NameFormula
p02ValueIF(phoneCall == "TRUE", FALSE, sendEmail)
SearchTermEdit column with formula

Results:

CustomerisActiveisInteresteddropCustsendEmailphoneCall
CustAYYFALSEFALSETRUE
CustBYNFALSETRUEFALSE
CustCNYFALSETRUEFALSE
CustDNNTRUEFALSEFALSE

D s also
labelexample_logical_functions