ANS-0188 · SAVED SEARCHES & FORMULAS

How to Compare Non-ASCII Characters in NetSuite Saved Searches?

Learn how to effectively compare and translate non-ASCII strings, such as Japanese or Chinese characters, within NetSuite saved search formulas.

Short answer

To compare non-ASCII characters in NetSuite saved searches, use the `ASCIISTR` function. This converts multi-byte characters into a comparable ASCII representation, enabling accurate comparisons. While `ASCII` only processes the leftmost character, `ASCIISTR` is suitable for full string conversion, ensuring proper evaluation of non-standard characters in your saved search formulas.

Scenario

NetSuite users often encounter challenges when attempting to compare strings that contain non-ASCII characters, such as Japanese or Chinese, directly within saved search formulas. Standard comparison methods may not accurately evaluate these multi-byte character sets, leading to incorrect results or failed comparisons when trying to match specific values or apply conditional logic.

Solution

To effectively compare non-ASCII characters within NetSuite saved search formulas, it is necessary to convert the character sets to an ASCII representation. While the ASCII function can be used, it is important to note that it returns the ASCII value of only the leftmost character of a string. An example of its usage for conditional logic is shown below:

ASCII('栃木県') ASCII({shipstate}) then 'Japanese State 1' else {shipstate} end

This formula checks if a specific Japanese state matches a predefined value and, if so, translates it to a readable name; otherwise, it outputs the original ship state.For converting an entire string containing non-ASCII characters to an ASCII representation suitable for comparison, the ASCIISTR function is more appropriate. Unlike ASCII, ASCIISTR is designed to handle full string conversion, making it suitable for scenarios requiring comprehensive string comparisons.Other functions like TEXT_DECODE are not available within the saved search formula dropdown in NetSuite and are therefore not supported for this purpose. Similarly, the N/encode module is a SuiteScript feature and cannot be utilized in saved search formulas for encoding or decoding operations.

Expert NetSuite Support

Need help with this NetSuite issue?

Saved Searches & Formulas consulting and configuration support

Talk to a consultant