ディスカッション
NetSuiteの保存検索やレポートをマスターするための究極のガイドである分析センターを使用して、データの力を最大限に活用しましょう。複雑さを単純化し、組織の真の可能性を解き放ちます。今すぐ分析センターに参加して、新たな高みを目指しましょう!
New AI Community Guidelines. Please review and follow them to ensure AI use stays safe, accurate, and compliant.
Update: Narrative Insights has been restored and is now available.
Narrative Insights is Temporarily Unavailable due to an Infrastructure Issue. Learn how This Impacts Your Account and What to Expect While the Feature is Disabled.
Narrative Insights is Temporarily Unavailable due to an Infrastructure Issue. Learn how This Impacts Your Account and What to Expect While the Feature is Disabled.
SuiteScript 2.0 > N/search > 列を降順にソートして、空の値を最後に表示させる
適用
Product: SuiteScript 2.0
シナリオ
SuiteScript 2.0で保存検索を作成し、特定の列(たとえばcustevent_test)をソート基準として降順に並べ替えようとしています。
期待される結果:custevent_test列に値を持つレコードが最初に降順でロードされ、次にその列に値がないレコードがロードされる。
実際の結果:custevent_test列に値のないレコードが最初にロードされ、次に値のあるレコードが降順でロードされる。
サンプルスクリプト:以下のスクリプトは、タイトルとcustevent_testを結果列としてタスクレコードを返します。
define(['N/search'], function (search) {
var mySearch = search.create({
type: 'task',
title: 'test',
columns: ['title', {
name: 'custevent_test',
sort: search.Sort.DESC
}
]
});
mySearch.run().each(function (result) {
var result = result.getValue({
name: 'custevent4'
});
log.debug('custevent_test', result)return true;
});
});
解決策
このエラーは、空のフィールドの値がNULLであるために発生します。これを修正するには、式列を追加し、値をNULLから空のスペースに変換します。
サンプルスクリプトは以下となります。
define(['N/search'], function (search) {
var mySearch = search.create({
type: 'task',
title: 'test',
columns: ['title', {
name: 'formulatext',
formula: 'NVL({custevent4}, \' \')',
sort: search.Sort.DESC
タグ付けされた:
0