ディスカッション

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.

SuiteScriptを使用してファイル内のテキストを検索する

編集済:Jun 2, 2025 2:48PM SuiteCloud / カスタマイズ

適用

製品: NetSuite 2021.1

シナリオ

現在、ファイルキャビネットに保存されているファイルは、グローバル検索または親レコードのサブ基準としてのみ検索できます。ただし、グローバル検索および保存検索ではコンテンツを検索することはできません。たとえば、ユーザーはテキストファイル、CSVなどからキーワードを見つける必要があるとします。

解決策

以下により、SuiteScriptを使用してファイルの中のテキストを検索することができます:

var searchText = 'Lorem ipsum';
var files = nlapiSearchGlobal('File: %.txt');//Indicates to search for files having .txt as the extension name. This can be changed to .csv, .html, etc. depending on what is needed
for (var i = 0; files !== null && i < files.length; i++) {
var fileId = files[i].getId();
try {
var file = nlapiLoadFile(fileId);
var index = file.getValue().toLowerCase().indexOf(searchText.toLowerCase());
nlapiLogExecution('DEBUG', 'Text ' + (index > 0 ? 'FOUND' : 'NOT found') + ' on File ' + file.getName() + ' (' + fileId + ')');//Shows if the text is found or not in the file on the for loop via the Execution Logs

ようこそ!

サインイン

完全な詳細を表示するには、サインインしてください。

登録

アカウントがありませんか?ここをクリックして始めましょう!

リーダーボード

コミュニティの達人

第2四半期 (4月~6月 2026)

今週のリーダー

今月のリーダー

歴代リーダー