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 Formula functions, see Formula.
Input
The Case tool requires one data input.
Configuration
Use the following configuration options to help create your case configuration.
Go to the Pipes module from the side navigation bar.
On the Pipes tab, find the pipe you want to work with. Click the pipe to open.
From the Pipes tab, click an existing pipe to open, or create a new pipe. To create a new pipe, read the Creating a pipe documentation.
In the Pipe builder, add a data source to your pipe. For more information on adding a data source, see the Data Input tool.
Click
+ Tool.The Tools modal opens, where you can add tools, such as the Aggregate tool, to your pipe.
In the search bar, search for Case. Click + Add tool.
Tip
You can also find the Case tool in the Calculate section.
Click the tool node and drag the line to the next tool to connect the tools. If you need to undo the action, click the line and then click Unlink.
In the configuration pane, under New column name, enter a name for the new column.
Under Default value, select the default value. If all logical tests fail, we will use the default value instead.
Under Select a column, select a column to filter.
Under Filter category, select a category to filter.
Under Value or text, select the value or text.
Under
AND+Statement, optionally use anANDstatement to filter.Under
OR+Statement, optionally use anORstatement 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.
Click on the tool name to rename your tool node to a meaningful name. Name your tools in a way that describes the function, not the object or the data action. For example, use “Look up rate” instead of “Join to rate table”.
Error messaging
The Case tool can identify the following errors in your formulas:
Syntaxerror: An invalid function is present, or the function cannot be parsed due to a special character, or a missing bracket.Invalid argumenterror: The tool detects that the argument is invalid due to a wrong data type.Too many argumentserror: The tool detects that there are too many arguments.Missing argumentserror: The tool detects that there are arguments missing from a function in your formula.Unsupported data typeerror: The tool detects an unsupported data type. The Formula tool only acceptsnumber,boolean,text, anddatedata types.