--- title: "行の更新" url: https://docs.catalyst.zoho.com/ja/sdk/flutter/v2/cloud-scale/data-store/update-rows/ description: "Data Storeテーブル内の特定の単一行またはすべての行を更新できます。" last_updated: 2026-03-30T08:10:30Z service: Cloud Scale type: general related_links: - name: "Data Store" url: /ja/cloud-scale/help/data-store/introduction - name: "Rows" url: /ja/cloud-scale/help/data-store/records - name: "Update Row - API" url: /ja/api/code-reference/cloud-scale/data-store/update-row/#UpdateRow --- # 行の更新 ### 特定の行を更新する 行インスタンスを取得した後、`update()`メソッドを使用して[Data Store](https://docs.catalyst.zoho.com/ja/cloud-scale/help/data-store/introduction)テーブル内の特定の単一行を更新できます。これにより、カラムの変更された値をキーと値のペアとして`setColumnValue()`メソッドに渡すことで、行の1つ以上のカラムの値を更新できます。 以下のコード構文で使用される`<ROW_INSTANCE>`は、[行インスタンスページ](https://docs.catalyst.zoho.com/ja/sdk/flutter/v2/cloud-scale/data-store/create-row-instance)で定義されたインスタンスです。 ```bash Future<(APIResponse, ZCatalystRow)> <ROW_INSTANCE>.update() ``` 行インスタンスの取得を含むサンプルコードスニペットを以下に示します: ```bash var (response, row) = ZCatalystApp.getInstance() .getDataStoreInstance() .getTableInstance(identifier: 'Products') .getRow(id: 2823000000014176) row.setColumnValue('product_quantity', '100'); //行の変更されたカラム名と値を渡す try { var (response, row) = await row.update(); print('Row updated successfully ${row.getColumnValue('product_quantity')}'); } on ZCatalystException catch (ex) { print('Failed to update the row $exception'); } ``` ### すべての行を更新する 行のリストを`updateRows()`メソッドの引数として渡すことで、テーブル内の複数の行を更新できます。行内で更新する各カラムのキーと値のペアに対して[行インスタンス](https://docs.catalyst.zoho.com/ja/sdk/flutter/v2/cloud-scale/data-store/create-row-instance)を取得し、`setColumnValue()`メソッドを通じて変更されたデータを渡す必要があります。次に、以下のコード構文に示すように、行インスタンスを配列に追加し、配列を`updateRows()`メソッドの引数として渡すことができます。 以下のコードで使用される`<TABLE_INSTANCE>`は、[テーブルインスタンスページ](https://docs.catalyst.zoho.com/ja/sdk/flutter/v2/cloud-scale/data-store/create-table-instance)で定義されたインスタンスです。 ```bash Future<(APIResponse, List<ZCatalystRow>)> <TABLE_INSTANCE>.updateRows(List<ZCatalystRow> rows) ``` **パラメータ**: * `rows`: 更新する行のリスト 行インスタンスの取得を含むサンプルコードスニペットを以下に示します: ```bash List<ZCatalystRow> modifiedRows = []; //配列を作成する var table = ZCatalystApp.getInstance() .getDataStoreInstance() .getTableInstance(identifier: 'Products'); //テーブルインスタンスを作成する try{ var (_, row) = await table.getRow(id: 2823000000014176); row.setColumnValue('product_price', '400'); modifiedRows.add(row); var (_, row) = await table.getRow(id: 2823000000014177); row.setColumnValue('product_price', '90'); modifiedRows.add(row); var (_, row) = await table.getRow(id: 2823000000014178); row.setColumnValue('product_price', '100'); modifiedRows.add(row); var (response, rows) = await table.updateRows(modifiedRows); } on ZCatalystException catch (ex) { print("Failed to update rows: $ex") } ```