UiPath Documentation
data-service
latest
false
Data Fabric ユーザー ガイド
重要 :
Data Service は現在 Data Fabric に移行中であり、デリバリー オプションによって使用されている名称が異なる場合があります。 このコンテンツの一部は機械翻訳によって処理されており、完全な翻訳を保証するものではありません。 新しいコンテンツの翻訳は、およそ 1 ~ 2 週間で公開されます。

エンティティをプロジェクトで使用する

Using Data Fabric entities in Studio projects to manage and manipulate aggregated data in automation processes.

By using entities created in Data Fabric, you can manage and manipulate data aggregated in a single object, without having to work with it in a granular way. To do so you need Studio v2020.8 or later.

以下のサンプルでは、オリンピック大会とメダルに関するデータのうち、競技の各カテゴリにおける上位 10 か国と、それらの国々が獲得したメダルのデータを収集します。

Entities in Data Fabric​

「 エンティティを作成する 」ページに詳細に記載された手順を実行して、参加国、開幕日と閉幕日、各国が獲得したメダルに関する情報を保存するエンティティを作成しました。

「Olympics」(オリンピック) エンティティには、名前 (Name)、参加国 (Nations)、開幕日 (Opening Date)、閉幕日 (Closing Date) といったフィールドがあります。「Medals」(メダル) エンティティには、国 (Country)、金 (Gold)、銀 (Silver)、銅 (Bronze)、総メダル数 (Total) といったフィールドがあります。これら 2 つのエンティティは、Relationship タグによって互いにリンクされています。

Studio にインポートされるエンティティ​

Studio のワークフロー内にエンティティをインポートします。

次のワークフローは、特定のオリンピック大会に関する情報をスクレイピングし、データを引数にマッピングして、それらをメイン ワークフローに渡します。

そのために、収集する情報の種類ごとに引数を定義し、5 つの引数がインポートされました。

エンティティを使用することで、データの収集に必要な作業は 2 つの引数のインポートと処理だけになりました。

注:

Entities must be initialized using the new operator, read from Data Fabric or passed through an input argument in a workflow before usage, otherwise assigning or reading their values can cause errors.

収集されたデータは、2 つの引数 inOlympics Year と outOlympics および対応するプロパティにマッピングされます。これらは、エンティティ内で定義されたフィールドと同じです。エンティティを使用し、対応するエンティティ フィールドにデータを適切にマッピングすることで、情報を渡すために必要な引数の数を減らすことができます。

データ レコードを作成する​

Once the data was collected, you can use the Create Entity Record activity to add the information to Data Fabric.

In this example, we used the imported arguments to pass the collected information to Data Fabric. The Input and Output records are the values of variables of type Olympics used for passing along the data.

After running the project, the following record was created in Data Fabric:

構造化データでレコードを作成する​

Records structured in a data table can be passed along to Data Fabric using the For Each Row activity. In this example, we're invoking a workflow that collects structured data on the number of medals won by each country and passes these records along to Data Fabric.

After running the workflow, the following data is stored in Data Fabric:

「Olympics」エンティティと「Medals」エンティティ間に設定されたリレーションシップによって、一方のデータ レコードを他方で使用することができます。たとえば、「Medals」エンティティ内の「Olympics」フィールドの値は、関連エンティティ内の値と同じになります。

The Query Entity Records activity can be used to pull up a list of records from Data Fabric. In the following example, we use the activity to query data records from the Olympics entity, allow the user to choose an Olympics edition, and from the Medals entity write the number of medals that each participating country won.

「Olympics」の表にクエリを実行するために、クエリ ビルダーの Name != NULL 条件を使用しました。これは、「Name」列のすべてのレコードを順に listOlympics 変数に出力し、[入力ダイアログ] アクティビティで使用できるようにします。

オプションとしてレコードのリストを表示するために、[ listOlympics.Select(Function (o as Olympics) o.Name).ToArray入力ダイアログ] アクティビティでは、以下の ラムダ式 を使用します。代わりに [ 繰り返し (コレクションの各要素 )] アクティビティを使用する方法もあります。

選択は selectedOlympics 変数にマッピングされ、もう一つの [エンティティ レコードにクエリを実行] アクティビティで、特定の大会で獲得したメダルのリストを順に調べるために使用されます。この条件は、クエリ ビルダーの equals オプションを使用して設定されました。

クエリは選択したエンティティと、その関連エンティティのレコードに対して実行できます。

ページネーション​

Data Fabric can potentially store a large number of records. To query only a certain number of records, use the Pagination properties from the Query Entities Records activity. The Top property supports a maximum number of 1,000, this means that 1,000 records can be queried at a time.

この例では、最初の 5 件のレコードに対してクエリを実行してから、次の 5 件に対して実行するという方法を、リストの最後のレコードが取得されるまで繰り返します。

これを実行するために、Int64 型の skip 変数に初期値 0 を代入してから、その値を各ループの後でインクリメントし、それを最後のレコードが取得されるまで繰り返します。

最初の 5 つのメダルを取得した後、[繰り返し (コレクションの各要素)] アクティビティを使用して、参加国およびそれらの国々が獲得したメダル数をメモ帳ファイルに書き出します。

エンティティ スキーマの更新​

The following scenario explains the steps for updating an entity schema in Data Fabric and then syncing the data with Studio.

In Data Fabric, go to the Medals entity, select Create New Field, and add a new column HostCountry of type Yes/No. Select Save.

Studio で [ エンティティを管理] を選択し、[ 更新 ] ボタンを選択します。[変更] 列に示すように、Medals エンティティで変化が検出されました。[ 保存 ] を選択すると、Studio でエンティティが更新されます。

レコードをクエリおよび更新する​

The Update Entity Record activity can be used for updating records from your workflow directly into Data Fabric.

この例では、「Medals」エンティティの特定のレコードに対してクエリを実行し、上記のアクティビティを使用してそれらを自動的に更新しています。

「Medals」エンティティでは、各大会の開催国を、国名の横にアスタリスクを付加して示しています。たとえば、2012 年大会の場合、開催国が「Olympics」列に「Great Britain (GBR)*」(英国) として記録されています。

[エンティティ レコードに対してクエリを実行] アクティビティを使用して、アスタリスク (*) を含むすべてのレコードを順に調べ、それらのレコードを listMedals 変数に取得します。次に、[繰り返し (コレクションの各要素)] アクティビティを使用して各項目をループし、その特定の大会が開催された国の横の「HostCountry」列に「True」値を代入します。

The Update Entity Record activity can be used in numerous other scenarios for passing along data and updating records in Data Fabric.

このページは役に立ちましたか?

接続

ヘルプ リソース サポート(opens in new window)

学習する UiPath アカデミー(opens in new window)

質問する UiPath フォーラム(opens in new window)

最新情報を取得