--- title: "配列およびオブジェクトの式" slug: "using-expressions-with-arrays" updated: 2026-10-22T10:00:48Z published: 2026-10-22T10:00:48Z canonical: "support.tulip.co/using-expressions-with-arrays" --- > ## Documentation Index > Fetch the complete documentation index at: https://support.tulip.co/llms.txt > Use this file to discover all available pages before exploring further. # 配列およびオブジェクトの式 *式エディタでの配列やオブジェクトの操作の基本を学びましょう。* Tulipでデータを扱うには、配列を操作するためにどの式を使用すべきかを理解することが不可欠です。また、式を使用してオブジェクトを個別のデータ型に分解することもできます。これにより、特定のデータに焦点を当て、アプリケーション内のプロセスを最適化することが可能になります。 --- ## 配列を用いた式 値を取得するために、さまざまな機能を持つ数種類の式があります。これらの値は、単一の値でも、別の配列でもかまいません。また、同じデータ型でも、異なるデータ型でもかまいません。 一部の式では、配列を使用して単純な算術値を返します: **array_max()**:指定された数値配列の最大値を返します。 ![array_max expression](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/array_max%20expression.png) **array_min()**指定された数値配列の最小値を返します。 ![array_min expression](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/array_min%20expression.png) **array_avg()**:指定された数値配列の平均値を返します。 ![array_avg expression](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/array_avg%20expression.png) ![Array Expressions - Max Min Avg](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/Array%20Expressions%20-%20Max%20Min%20Avg.gif) その他の式では、標準偏差を使用して値を返します。 **array_stdev_population()**指定された数値配列の母集団の標準偏差を返します。 ![array_stdev_population expression](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/array_stdev_population%20expression.png) **array_stdev_sample()**指定された数値配列の標本から標準偏差を返します。 ![array_stdev_sample expression](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/array_stdev_sample%20expression.png) ![Array Expressions - StDev Pop Samp](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/Array%20Expressions%20%20-%20StDev%20Pop%20Samp.gif) **array_at_value_index:**指定されたリストの指定されたインデックスにある値を**返します**。インデックスが範囲外の場合は、null を返します。 ![array_value_at_index ex](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/array_value_at_index%20ex.png) Tulipプラットフォームで最も広く使用されている式の一つは次のとおりです: **array_index_of()**指定された配列内で、指定された値が最初に現れるインデックスを返します。見つからない場合は「-1」を返します。 ![array_index_of expression](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/array_index_of%20expression.png) ![Array_Index_Of Ex](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/Array_Index_Of%20Ex.png) [このコミュニティの投稿で](https://community.tulip.co/t/programmatically-connect-to-serial-devices-with-player-triggers/8133)説明されているように、array_index_of() を使用すると、シリアルドライバ上の COM ポートを特定できます。また、[コネクタの出力](/r230/docs/connectors)結果から特定の作業指示書を見つける際にも使用できます。 **LEN()**:配列内の要素数を返します。![Len expression ex](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/Len%20expression%20ex.png) また、配列を使用して特定の値を判定する式もあります。例えば、次のようなものです。 **arraycontains()**:指定された値が指定された配列に含まれている場合は「true」を返し、そうでない場合は「false」を返します。 ![arraycontains expression yes](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/arraycontains%20expression%20yes.png) ![Array Expressions - Contains](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/Array%20Expressions%20-%20Contains.gif) 以下の式は、[正規表現](https://regex101.com/)を使用して配列を返します。[このチートシートを](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions/Cheatsheet)参照して、正規表現の機能や構文を理解することもできます。 **regex_match()**:正規表現に一致する項目の配列を返します。 ![regex_match expression ex](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/regex_match%20expression%20ex.png) ![regex_match expression ex in app](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/regex_match%20expression%20ex%20in%20app.png) **regex_replace()**:式で定義された文字列置換が適用された配列を返します。 ![regex_replace expression ex](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/regex_replace%20expression%20ex.png) ![regex_replace expression ex in app](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/regex_replace%20expression%20ex%20in%20app.png) 最後に、データ型が類似した複数の配列を結合して、新しい配列を作成することができます。 **array_concat()**単一の型を持つ任意の数の配列を、その型の単一の配列に連結します。 ![Array_Concat Expression](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/Array_Concat%20Expression.png) ![Array_Concat Ex](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/Array_Concat%20Ex.png) ## オブジェクトを含む式 Tulip では、オブジェクトを使用する式はすべて同じ機能を持っています。つまり、あるオブジェクトからデータを収集し、単一のデータ型を使用する別のオブジェクトに格納します。以下の式は同様に機能し、指定されたキー(ヘッダー)を使用して、オブジェクト配列を基本配列に変換します。 **map_to_boolean_list()**指定されたキーについて、オブジェクト配列をブール値の配列に変換します。![map_to_boolean_list ex](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/map_to_boolean_list%20ex.png) **map_to_integer_list()**指定されたキーに基づいて、オブジェクト配列を Integer 配列に変換します。![map_to_integer_list ex](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/map_to_integer_list%20ex.png) **map_to_number_list()**オブジェクトの配列を、指定されたキーに対する数値の配列に変換します。 ![map_to_number_list ex](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/map_to_number_list%20ex.png) **map_to_text_list()**オブジェクトの配列を、指定されたキーに対応するテキストの配列に変換します。![map_to_text_list ex](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/map_to_text_list%20ex.png) 以下の例では、オブジェクト配列にはオブジェクトごとに 4 つのデータ見出しがあります。ボタントリガーはデータ操作を使用して、各キー(見出し)のデータをそれぞれの変数配列(ブール値、数値など)に格納します。 ![map to text ex in app](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/map%20to%20text%20ex%20in%20app.gif) 上記の map_to_text 式を array_index_of() と組み合わせて使用することで、コネクタ関数 Output から情報を抽出できます。 **Output** An **output** is the transmission of data from a program to a data set.