--- title: "行からカラム値を取得" url: https://docs.catalyst.zoho.com/ja/sdk/ios/v2/cloud-scale/data-store/column-value-from-row/ description: "Data Storeテーブルの行内の特定のカラム値を取得できます。" last_updated: 2026-03-24T12:08:39Z service: Cloud Scale type: general related_links: - name: "Data Store" url: /ja/cloud-scale/help/data-store/introduction - name: "Records" url: /ja/cloud-scale/help/data-store/records - name: "Columns" url: /ja/cloud-scale/help/data-store/columns - name: "Get Metadata of Columns - API" url: /ja/api/code-reference/cloud-scale/data-store/get-all-columns-metadata/#GetAllColumnsMetadata --- # 行からカラム値を取得 [Data Store](https://docs.catalyst.zoho.com/ja/cloud-scale/help/data-store/introduction)テーブルの行内の特定のカラム値を取得できます。つまり、行内の「Employee ID」カラムの値のみが必要な場合、この操作を使用して取得できます。 この操作は、以下に示す3つの方法で実行できます。 以下のすべてのコードセクションで使用されている`<ROW_INSTANCE>`は、[行インスタンスページ](https://docs.catalyst.zoho.com/ja/sdk/ios/v2/cloud-scale/data-store/create-new-row-instance)で定義されたインスタンスです。 ### カラムのデータ型がわかっている場合: ```bash let data : <T> = try <ROW_INSTANCE>.getValue(forKey: "<columnName>") ``` **パラメータ**: * `T`: 期待される値のデータ型 * `columnName`: 取得するカラムの名前 サンプルコードスニペットは以下の通りです: ```bash ZCatalystApp.shared.getDataStoreInstance().getTableInstance(id: 1096000000002071).getRow(id: 1096000000002845) {( result ) in //これをあなたのテーブルIDに置き換えてください and ROWID switch result{ case .success ( let row) : do{ let data : String = try row.getValue(forKey: "EmpID") as! String print(data) } catch{ print("Error occured") } case .error( let error ) : print( "Error occurred >>> \( error )" ) } } ``` ### カラムのデータ型がわからない場合: ```bash let data : <T>? = <ROW_INSTANCE>.getValue(forKey: "<columnName>") ``` **パラメータ**: * `T`: 期待される値のデータ型 * `columnName`: 取得するカラムの名前 サンプルコードスニペットは以下の通りです: ```bash ZCatalystApp.shared.getDataStoreInstance().getTableInstance(id: 1096000000002071).getRow(id: 1096000000002845) {( result ) in //これをあなたのテーブルIDに置き換えてください and Row ID switch result{ case .success ( let row) : let data :String? = row.getValue(forKey: "EmpID") print(data) case .error( let error ) : print( "Error occurred >>> \( error )" ) } } ``` ### getValue()を使用しない場合: ```bash let data : <T>? = <ROW_INSTANCE>[ "<columnName>" ] ``` **パラメータ**: * `T`: 期待される値のデータ型 * `columnName`: 取得するカラムの名前 ```bash ZCatalystApp.shared.getDataStoreInstance().getTableInstance(id: 1096000000002071).getRow(id: 1096000000002845) {( result ) in //これをあなたのテーブルIDに置き換えてください and Row ID switch result{ case .success ( let row) : let data :String? = row[ "EmpID" ] print(data) case .error( let error ) : print( "Error occurred >>> \( error )" ) } } ```