How To: Netsuite Case When Formula with Multiple Conditions
Quick introduction:
NetSuite Saved Searches and formula fields are often the lifeline for Netsuite users. Using Formula fields in Oracle SQL functions allows users to enhance search results quickly and easily.Â
One of the most helpful and commonly used SQL functions is the CASE when function. When using SQL expressions in NetSuite, the CASE function allows users to start making conditional statements.
This is rather similar to the =IF function in Microsoft Excel. When combined with ‘WHEN’, ‘THEN’, ‘ELSE’, and ‘END’, it allows users to make functional conditional formulas. Taking it a step further, there may be scenarios when you need to use multiple Case conditions in NetSuite.
While it can be a bit tricky to debug or look for syntax errors in formulas with multiple conditions, there is a simple solution. In this step-by-step guide, we will learn how to create a NetSuite case with multiple Cases when statements are in criteria.
Step-by-Step Process To Use Multiple CASE Conditions in NetSuite
There are various scenarios when users will need to use multiple conditions in a formula to boost efficiency, streamline processes, or even simplify complex formulas.
For instance, consider the formula below:
This expression allows the user to test multiple scenarios before concluding with the ‘ELSE’ outcome.
Let us use an example to put this formula into action. For instance, we want to show the sum-up amount for when the ship date is between two different dates and the status is “Pending Fulfillment.”
Here are the steps to combine the two case-when statements in NetSuite:
Step 1: Access Saved Searches in NetSuite
- Navigate to Reports and scroll down to “Saved Searches” in the dropdown menu.
- Select “All Saved Searches,” then click “New.”
- Scroll down the list and click “Transaction.”
Step 2: Modify The Saved Search And Add The Criteria
A new window will appear where you can modify the Saved Search.
- Modify the Search Title
- Add the filters to the formula. First, click on the first Filter field, scroll down the list, and click Type.
- Keep the Type “any of” and type “Sales Order” in the field. Then, click “Set.”
- Similarly, click on the first Filter field, scroll down the list, and click Main Line.
- Select the “Yes” option, then click “Set.”
- Next, select “Formula (Numeric)”
- Under Formula, add the formula provided. Adjust the specific criteria. In this use case, add the dates.
- Under Formula Numeric, select “Not equal to.”
- Under Value, type in 0.
- Then, click “Set.”
- Under the “Results” tab, navigate to the “Column” section and add or remove fields according to your preference.
- For this case, add “Status” and “Shipped Date” to verify the results of the formula.
- When you are done, click “Save and Run”.
Step 3: Verify The Results
- The results of the saved search will appear. You can review and verify the results for accuracy by checking the dates of the transactions and the Ship Date columns. You can also check the status of the Sales Orders that are “Pending Fulfillment.”
- Your formula worked!
Wrapping Up
Case When statements are a great way to streamline processes and run otherwise complex formulas to yield simpler results. Remember, always refer to the basic Case when formula and use that to build in more complex criteria.
By following the steps outlined, you can quickly and easily create Saved Searches in NetSuite for complex formulas and criteria. Once you master the basics, you can boost your efficiency, streamline processes, and leverage the many advantages of NetSuite.