Skip to content
3 min read

Using Formulas to Create Powerful Saved Searches in NetSuite

Featured Image

One of the most useful tools in NetSuite is the Saved Search feature, which allows users to create custom reports based on specific criteria. And one of the key components of a Saved Search in NetSuite is the use of formulas. 

Formulas are expressions that can be used to perform calculations, manipulate text or date values, and even create conditional statements to filter search results. 

In this article, we'll explore the basics of using formulas in NetSuite Saved Searches and provide some examples of how they can be used.

Basic Formula Syntax in NetSuite

Formulas in NetSuite Saved Searches are written using a specific syntax that includes operators, functions, and variables. The basic syntax for a formula in NetSuite is as follows:

{expression} {operator} {expression}

The expressions can be any valid NetSuite field, function, or literal value. The operators are used to perform mathematical, logical, or string operations on the expressions. The variables are used to represent the results of the expressions or to store temporary values for use in subsequent calculations.

NetSuite supports a wide range of functions that can be used in formulas, including mathematical functions like ROUND, ABS, and MOD; date functions like ADD_MONTHS and DATE_DIFF; and string functions like CONCAT, LENGTH, and TRIM.

Examples of Formula Usage in NetSuite

Let's take a look at some examples of how formulas can be used in NetSuite Saved Searches.

1. Calculating a Custom Sales Total

Suppose we want to create a Saved Search that calculates the total sales for each customer, including discounts and promotions. To do this, we can create a formula field that adds the values of the "Amount" and "Discount" fields, like so:

{Amount} + {Discount}

Creating saved searches using formulas in NetSuite

We can then group the results by customer to see the total sales for each customer.

2. Filtering Results Based on Date Ranges

Suppose we want to create a Saved Search that shows all sales orders placed in the last month. To do this, we can create a formula that calculates the date range for the last month and use it to filter the search results, like so:

{trandate} between ADD_MONTHS(sysdate,-1) and sysdate

This formula uses the ADD_MONTHS function to subtract one month from the current date (sysdate) and create a date range that includes all transactions between that date and the current date.

3. Creating Conditional Statements

Suppose we want to create a Saved Search that shows all sales orders with a total value greater than $10,000. To do this, we can create a formula that checks the value of the "Total" field and filters the search results based on that value, like so:

CASE WHEN {Total} > 10000 THEN 'Yes' ELSE 'No' END

This formula uses a conditional statement (CASE WHEN) to check whether the value of the "Total" field is greater than $10,000. If it is, the formula returns "Yes". If not, it returns "No".

In Summary

Formulas are a powerful tool for creating custom reports in NetSuite Saved Searches. They allow users to perform calculations, manipulate text and date values, and create conditional statements to filter search results. By using formulas in NetSuite, businesses can gain valuable insights into their operations and make data-driven decisions that can help them achieve their goals.

Want to get even more out of NetSuite? See how Payference is helping NetSuite users automate Improve cash flow with speedier collections and better forecasting in one easy-to-use cash management solution. Learn more