πΉ Why Use Formulas in Saved Searches?
Saved Searches are powerful, but sometimes the built-in filters and columns arenβt enough.
Formulas let you:
- Add custom logic (IF/ELSE with
CASE). - Transform field values (e.g., uppercase, substrings).
- Do date math (days open, overdue, etc.).
- Group, flag, or categorize results for reporting.
Formulas support Text, Numeric, and Date types.
πΉ Formula Basics
- Formula (Text) β returns text values.
- Formula (Numeric) β returns numbers.
- Formula (Date) β returns dates.
Tip: Always test in small searches firstβNetSuite formula syntax is close to Oracle SQL, but with restrictions.
πΉ Common Formula Examples
1) β Overdue Flag (Text)
CASE WHEN {duedate} < SYSDATE THEN 'Overdue' ELSE 'On Time' END
- Returns βOverdueβ if due date is before today.
- Works in Formula (Text) column.
2) β Days Open (Numeric)
TRUNC(SYSDATE) - TRUNC({trandate})
- Calculates number of days since transaction date.
- Use in Formula (Numeric).
3) β Month Name from Date
TO_CHAR({trandate}, 'Month')
- Extracts month name of the transaction.
- Use in Formula (Text) column.
4) β Current Year Transactions Only (Filter)
EXTRACT(YEAR FROM {trandate}) = EXTRACT(YEAR FROM SYSDATE)
- Filter for only this yearβs transactions.
- Put under Formula (Numeric) filter β
equal toEXTRACT(YEAR FROM SYSDATE).
5) β Customer Category: Big vs Small
CASE WHEN {amount} >= 10000 THEN 'High Value'
WHEN {amount} BETWEEN 5000 AND 9999 THEN 'Medium Value'
ELSE 'Low Value'
END
- Classifies transactions into categories.
- Great for pivot reports in Excel.
6) β Remove Time from Date
TRUNC({trandate})
- Returns only the date (midnight).
- Helpful for grouping by date without time noise.
7) β First 5 Characters of Customer Name
SUBSTR({entityid}, 1, 5)
- Use in Formula (Text) to extract part of a string.
8) β Show Only Weekday Transactions
CASE WHEN TO_CHAR({trandate}, 'DY') IN ('SAT','SUN') THEN 'Weekend' ELSE 'Weekday' END
- Splits transactions into Weekday vs Weekend.
9) β Combine Multiple Fields
{firstname} || ' ' || {lastname}
- Concatenates two fields (first + last name).
- Formula (Text).
10) β Aging Buckets (0β30, 31β60, 61+)
CASE
WHEN TRUNC(SYSDATE) - TRUNC({duedate}) <= 30 THEN '0-30 Days'
WHEN TRUNC(SYSDATE) - TRUNC({duedate}) BETWEEN 31 AND 60 THEN '31-60 Days'
ELSE '61+ Days'
END
- Classic AR/AP report aging buckets.
πΉ Advanced Examples
11) β Find Transactions on Last Day of Month
CASE WHEN {trandate} = LAST_DAY({trandate}) THEN 'Month End' ELSE 'Regular' END
12) β Flag International Orders
CASE WHEN {shipcountry} != 'US' THEN 'International' ELSE 'Domestic' END
13) β Extract Year-Month Key for Grouping
TO_CHAR({trandate}, 'YYYY-MM')
14) β Compare Two Fields
CASE WHEN {total} != {amountpaid} THEN 'Open' ELSE 'Closed' END
πΉ Tips & Best Practices
β
Use Formula (Text) for labels, categories, or concatenated fields.
β
Use Formula (Numeric) for counts, days difference, math.
β
Use Formula (Date) for calculated dates (add days, remove time).
β
Wrap formulas in CASE for clean logic.
β
Test in small searches before production.
β
Remember: SYSDATE = todayβs date.
β Summary
Saved Search formulas are like βmini SQLβ inside NetSuite. They allow you to:
- Flag records,
- Classify data,
- Do math with dates and numbers,
- Make your reports smarter and easier to analyze.
With formulas, you can transform basic searches into powerful reports and dashboards without custom scripts.
Leave a Reply