Case
Label your data in a specific way using the Case tool.
Adds a label to data according to logical tests.
To add labels to your data:
Pick a name for the new column.
Select the default value. If all logical tests fail, we use the default value instead.
Define any number of logical tests. The value of the first successful logical test will be used.
You can set as many logical tests as you'd like, but there can be only 1 default value.
Reorder and move cases the way you want. Use the drag and drop icon to reorder your cases.
When to use this tool
Use when you want to label your data in a specific way.
The Case tool supports both filter and formula expressions, with the filter function as the default. You can switch between the two functions as necessary.
With the filter function, you can select a column to filter and then choose the filter category and value or text. You can use AND
or OR
statements to filter. For more information about the Filter functions, see Filter.
With the formula function, you can apply a formula to the data. The formula must return a value of TRUE
or FALSE
. For more information about the Forumla functions, see Formula.
Input
The Case tool requires one data input.
Configuration
Use the following configuration options to help create your case configuration.
In Pipe builder, add your data source.
Click +Add Tool.
Click See all tools.
In the search bar, search for Case. Click Add tool.
Tip
You can also find the Case tool in the Calculate section.
Connect the tool to your data set.
In the configuration pane, enter the following information:
Table 33. Case tool configurationField
Description
New column name
Enter a name for the new column.
Default value
Select the default value. If all logical tests fail, we will use the default value instead.
Select a column
Select a column to filter.
Filter category
Select a category to filter.
Value or text
Select the value or text.
AND
+StatementOptional: Use an
AND
statement to filter.OR
+StatementOptional: Use an
OR
statement to filter.Note
You can have a mix of filters and formulas in your configuration. Apply a formula to a filter instead of using a case filter. Click Switch to formula in the Cases section. If you want to revert back, click Switch to filter in the Formula section.
Error messaging
The Case tool can identify the following errors in your formulas:
Syntax
error: An invalid function is present, or the function cannot be parsed due to a special character, or a missing bracket.Invalid argument
error: The tool detects that the argument is invalid due to a wrong data type.Too many arguments
error: The tool detects that there are too many arguments.Missing arguments
error: The tool detects that there are arguments missing from a function in your formula.Unsupported data type
error: The tool detects an unsupported data type. The Formula tool only acceptsnumber
,boolean
,string
, anddate
data types.