# Common Mistakes with Saved Search Formulas in NetSuite

Saved searches are one of NetSuite’s most important tools — it allows users to search and filter data stored in their account based on user-defined criteria and conditions. Saved Searches can be used to find specific records, create custom reports, or automate business processes — and are created using specific formulas.

However, there are common mistakes that users make when using these formulas. In this blog post, we will discuss these mistakes and how to avoid them.

### What is a Saved Search Formula?

First, let's define what a saved search formula is. A saved search is a predefined search query that allows users to filter and analyze data within NetSuite. A saved search formula, on the other hand, is a custom expression that allows users to perform calculations or manipulate data within a saved search. These formulas can be used to perform calculations, concatenate fields, and convert data types. The most common mistake users make is not understanding the syntax of the formula they are using.

### Types of Saved Search Formulas

There are many different formulas that can be used in a saved search in NetSuite, but here are some of the most common ones:

**Text formulas:**These formulas can be used to manipulate and concatenate text fields. For example, you can use the CONCAT formula to combine the values of two or more fields into one field.**Date formulas:**These formulas can be used to perform calculations and manipulations on date fields. For example, you can use the ADD_MONTHS formula to add a specific number of months to a date field.**Numeric formulas:**These formulas can be used to perform calculations on numeric fields. For example, you can use the DIV formula to divide the value of one field by the value of another field.**Conditional formulas:**These formulas can be used to set conditions for displaying search results. For example, you can use the CASE formula to display a specific value when a certain condition is met.**Summary formulas:**These formulas can be used to calculate and display summary values for a group of search results. For example, you can use the SUM formula to calculate the sum of a numeric field for a group of results.**Regular expressions:**These formulas can be used to search for patterns within text fields. For example, you can use the REGEXP_MATCH formula to search for text that matches a specific pattern.

### Common Saved Search Formula Mistakes

Saved searches are a powerful tool, but they can be tricky to use; even the most established NetSuite admins make mistakes when creating them. Here are some common mistakes users make when working with saved search formulas in NetSuite:

**Syntax errors:**The most common mistake with saved search formulas is syntax errors. Make sure to double-check your formulas for typos, misspelled words, incorrect field names, or missing parentheses.**Case sensitivity:**NetSuite is case-sensitive, so make sure to use the correct capitalization when referencing fields and functions in your formulas.**Formula evaluation order:**Make sure to consider the evaluation order of your formulas. For example, if you are using a CASE statement, the order of your WHEN clauses matters.**Using invalid operators:**Avoid using invalid operators or trying to compare fields of different data types. For example, you cannot use the CONTAINS operator on a numeric field.**Formula length limitations:**Be mindful of the length of your formulas. NetSuite has a maximum length limit for formulas, so keep your formulas concise and avoid creating overly complex formulas.**Performance issues:**Be careful when using formulas that require a lot of processing power or that reference a large number of records. These types of formulas can cause performance issues and slow down your system.

### How to Avoid Common Saved Search Formula Mistakes

Creating saved searches is complex — and even small mistakes can cause big problems or produce inaccurate or useless data. Here are some tips to help users avoid common saved search formula mistakes:

**Understand the data types:**Before writing formulas, it's important to understand the data types you're working with. Different data types have different rules for how they can be used in formulas. For example, you can't add a date to a text field. Make sure you're using the correct data types in your formulas.**Test your formulas:**Always test your formulas before saving them. Run them in the search preview to make sure they're returning the data you expect. You can also use the formula debugger to identify and correct errors in your formulas.**Use parentheses:**When working with complex formulas, it's important to use parentheses to make sure the formula is evaluating in the correct order. If you're not sure where to put the parentheses, use the formula debugger to help you.**Check for syntax errors:**Netsuite will highlight syntax errors in red, so make sure to double-check your formulas for any errors before saving them.**Use case functions:**If you're working with text fields, make sure to use the proper case function (e.g. UPPER, LOWER, PROPER) to format your data correctly.**Consider performance:**Complex formulas can slow down your search results, so it's important to optimize your formulas for performance. Use the simplest formula possible to get the results you need.

Saved searches are a powerful tool in NetSuite that allow users to extract important information from their data. However, creating saved search formulas can be challenging, and mistakes can lead to inaccurate or incomplete results. To avoid common mistakes such as syntax errors, incorrect formula references, or formula nesting issues, users should carefully review their formulas, test them thoroughly, and seek guidance from NetSuite documentation or experienced users.

By following best practices and avoiding common pitfalls, users can leverage saved search formulas to gain valuable insights into their business and make data-driven decisions.