Resources / Article

NetSuite saved search formula examples with CASE WHEN

NetSuite saved search formula examples: CASE WHEN, blank checks and today's date, plus which formula type to pick on each subtab.

You enter a saved search formula on the Criteria subtab or the Results subtab, and the formula type you pick there decides how NetSuite validates the expression. The examples below are expressions you can type into a search, covering CASE WHEN, NVL2, CURRENT_DATE and TO_NUMBER.

Where do you enter a formula in a saved search?

On the Criteria subtab, the Filter column lists formula types alongside the field names. Formula (Text) is the type Oracle names for character manipulation with regular expressions, and Formula (Numeric) suits numeric calculations, because validation rules change with the type you choose (Oracle help). Formula (Date) appears in that same Filter list.

The Results subtab puts the choice in the Field column and offers a longer list, including Formula (Currency), Formula (Date), Formula (Date/Time), Formula (Percent) and Formula (HTML) (Oracle help).

Where a saved search formula goesTable. Criteria subtab, Filter column: Formula (Text), Formula (Numeric) and Formula (Date). Results subtab, Field column: also Formula (Currency), Formula (Date/Time), Formula (Percent) and Formula (HTML). Example Formula (Text): CASE WHEN {duedate} < CURRENT_DATE THEN 'Past due' ELSE 'Open' END.Subtab and columnFormula types offeredCriteria, FiltercolumnFormula (Text), (Numeric),(Date)Results, FieldcolumnThose, plus (Currency),(Date/Time), (Percent), (HTML)Formula (Text) example:CASE WHEN {duedate} < CURRENT_DATETHEN 'Past due' ELSE 'Open' ENDValidation rules change with the type you choose
Where each formula type is offered, and Oracle's CASE WHEN example for past-due dates.

Formula (Text) examples

Oracle's Formula (Text) example for search results compares a due date with the current date and returns one label or the other (Oracle help):

CASE WHEN {duedate} < CURRENT_DATE THEN 'Past due' ELSE 'Open' END

Oracle's second Formula (Text) example joins a quantity to an item name (Oracle help):

{quantity} || 'x ' || {item}

Formula (HTML) builds a link from the entity ID and the entity name, and Oracle's example opens the record in a new tab (Oracle help). Oracle's NVL2 example returns a green "Approved" span when a field holds a value and a red "Not Approved" span when it is empty.

Integer Number fields show only 13 characters in a saved search, so switch to Formula (Text) when the value runs to 14 digits or more (Oracle help).

Line numbers on transaction lines

Line numbers come from a custom transaction column field. Set the type to Integer Number, clear Store Value, apply the field to the transactions you want, set the display type to Disabled, tick the Formula box on the Validation & Defaulting subtab, and enter {linenumber} as the default value (Oracle help). The Applies to subtab is where you tick the transactions that carry the field, and where you tick Print on Standard Forms. The line number shows when you view the transaction record. To get it onto a printed form, open the custom transaction form, go to the Printing Fields, Columns subtab, and tick Print/Email against the field.

Formula (Numeric) examples

Oracle's Formula (Numeric) example is a field reference, {field_id} (Oracle help). Formula (Currency) wraps a currency field with TO_NUMBER, and Oracle's example is TO_NUMBER({amount}). Formula (Percent) takes an expression such as % of total 30/100.

Formula (Date) examples

Formula (Date) uses TO_DATE to turn a text value into a date, and Oracle's example passes a date string with a MM/DD/YYYY format mask (Oracle help). For the current date and time, use {now} in a Formula (Date/Time) result. To test whether a date has passed, compare a date field with CURRENT_DATE inside a CASE WHEN.

Example: overdue invoices in INR

Amounts in INR.

Criteria:

Results:

DateLabelAmount (INR)
12/03/2025Past due2,45,000
28/03/2025Past due87,500
05/04/2025Past due1,20,000

Total overdue: 4,52,500 INR.

Keep the searches your client signs off in the BRD template for ERP implementation so the definitions survive the handover.

Trade-offs

How do saved search formulas differ from SuiteAnalytics Workbook formulas?

Saved search formulas are expressions you add on the Criteria subtab or the Results subtab (Oracle help). SuiteAnalytics Workbook gives you custom formula fields that mix NetSuite fields with SQL formula functions, and you set an output type when you create the field (Oracle help). Output types include Boolean, Date, Datetime, Float, Integer, String, Clobtext, Percent and Duration (Oracle help). A Boolean field returns true, false or a null value. A formula field goes into a dataset from the Data Grid, where it can act as a filter or feed any visualization built on that dataset. Workbook also supports formula context values such as #converted. The Formula Builder lists basic formulas for each output type, including a Boolean CASE WHEN on transaction days overdue.

KPI scorecard formulas

KPI scorecard formulas live in the portlet. Open the portlet menu and choose Customize, then go to the KPIs tab under Content and pick a formula from the KPI list (Oracle help). Type the expression in the Formula column, or open the Formula popup from the Set Formula icon, where the Function list adds functions and the KPIs dropdown adds KPI IDs. You can also edit the expression directly in the Formula field and click Set when you finish. A custom KPI used in a formula is set up on the Custom subtab.

Common mistakes with saved search formulas

FAQ

Can I use CASE WHEN in a saved search formula?
Yes. Oracle shows CASE WHEN in the Formula (Text) example for search results (Oracle help).

Does NetSuite have a function for empty fields?
Oracle's Formula (HTML) example uses NVL2 to return one string when a field has a value and another when it does not (Oracle help).

Can a formula reference another formula?
In SuiteAnalytics Workbook, no (Oracle help).

Where do KPI scorecard formulas live?
In the KPI scorecard portlet (Oracle help).

The quick way is mark.: it reads the saved search and the records behind it, finds the cause and tells you the exact fix. Try it free.

Sources

  1. docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/bridgehead_N2832808.html
  2. docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_1206103522.html
  3. docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_1544128605.html
  4. docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_N613116.html
  5. docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_N661053.html
  6. docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_N661334.html

Have mark. check this against the client's own files

mark. reads the client's files and sets each point against them, with the source beside it.

Book a working session

Twenty minutes on one client folder. Your 21-day trial opens on the call.

Start your free trial

Three questions, and Mark opens an account for you on NetSuite.

Which ERP do your clients run?

Your account opens within one working day.