30日間の無料評価版をお試しいただけます。

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

Table of Contents
classcontents

...

はじめに

Styleclass
ClasstopLink

top

In this tutorial, we will walk through setting up a Union sub query. A good way to this about Unions is - use them if you need to combine multiple fields into the one column, either from the same or different views or sources.

In this scenario our main report will have a list of invoicing figures by region, we will then use the Union query to display negative cost figures in the same column, and then add sub totals to see the total income for each region.

Master Query

The Master Query is going to include:

ページトップ

このチュートリアルでは、結合サブクエリーの設定を段階的に説明します。結合は、同じまたは異なるビューやソースから、複数のフィールドを1つのカラム(列)に組み合わせる必要がある場合に使用するものと考えるとよいでしょう。

このシナリオのメインレポートでは、地域別の請求額の一覧を設定します。次に、結合クエリーを使用して同じカラム(列)内にある負のコスト数値を表示した後、小計を追加して地域ごとの合計収入を確認します。

マスタークエリー

マスタークエリーには以下の項目を含めます:

  1. Camp Region
  2. 計算フィールド: "Invoiced" テキストラベル
  3. Camp Region
  4. Calculated Field: "Invoiced" text label
  5. Sum Invoiced Amount

Union Query

結合クエリー

結合クエリーには以下の項目を含めます:The Union Query will include:

  1. Camp Region
  2. Calculated Field: 計算フィールド:"Cost" text label
  3. Calculated Field: Sum Cost * -1 (to convert the Cost figures to a negative value)

...

  1. テキストラベル
  2. 計算フィールド:Sum Cost × -1 (コスト数値を負の値に変換します)

初期化

Styleclass
ClasstopLink

topページトップ

Section
Column
width30%

1. Click on the Create link and select Report to begin building your report. 作成」リンクをクリックして、「レポート」を選択しレポートの作成を開始します。

Column
width70%

Section
Column
width30%

2. You should now be on the Initialise Report page. Select the Drag and Drop Builder as the build tool. 「レポートの初期化」ページが表示されます。作成ツールとして「ドラッグ&ドロップで作成」を選択します。

Column
width70%

Section
Column
width30%

3. Select ビューとして「Ski Team as the View.」を選択します。

Column
width70%

...

マスタークエリー

Styleclass
ClasstopLink

topページトップ

Section
Column
width30%

4. Drag and drop the Camp Region dimension and 」ディメンションおよび「 Invoiced Amount metric into the Columns list. 」メトリックを「カラム(列)」にドラッグ&ドロップします。

Column
width70%

...

ラベルフィールド

マスタークエリーを完了するには、ラベルフィールドが必要となります。このフィールドは、マスタークエリーのロウ(行)を"Invoiced"ロウ(行)として識別するために使用されます。結合クエリーで同様の計算が行われ、"Cost"としてロウ(行)が識別されます。

Section
Column
width30%

To complete the master query, a label field is required. This will be used to identify the rows from the master query as "Invoiced" rows. There will be a similar calculation in the union query to identify rows as "Cost".

5. Click on the + to create a calculated field, in the bottom of the View Fields List panel. 5. ビューフィールド一覧パネルの下部で「+」をクリックし、計算フィールドを作成します。

Column
width70%

Section
Column
width30%

6. Set the Calculated Field Name to Label
Note: the name for this field can be anything, it will not change the way the union works if it's called something else. 計算フィールド名」をLabelに設定します。
注意:このフィールドの名前は任意です。名前が変更されても結合の処理方法は変更されません

7. ここで示すように、メイン計算パネルでテキストボックスにInvoicedと入力し、「+追加」をクリックして計算式に追加します。7. Type Invoiced into the text box under the main calculation panel, as shown here, and click + Add to add it to the calculation.

Column
width70%

Section
Column
width30%

8. テスト」ボタンをクリックして、計算式が正しく作成されたことを確認します。

9.保存」ボタンをクリックして、計算式を完了します。 Click the Validate button to ensure your calculation is built correctly. 9. Click the Save button to complete your calculation.

Column
width70%

Section
Column
width30%

10. Drag the Label calculation to between the カラム(列)」または「表のプレビュー」のどちらかで、計算フィールドの「Label」を、「Camp Region and 」と「Sum Invoiced Amount fields in either the Columns list or Table Preview.」のフィールドの間にドラッグします。

Column
width70%

...

結合クエリー

Styleclass
ClasstopLink

topページトップ

...

結合の作成

Section
Column
width30%

611. Click on the + button in the Sub Query panel to the left of the Data step to add a Sub Query.

7. Set the Type to Union and Style to Basic.

「データ」ステップの左側にある「サブクエリー」パネルで「+」ボタンをクリックし、サブクエリーを追加します。

12. 「タイプ」を「結合」に、「スタイル」を「基本」に設定します。

13.OK」をクリックしてクエリーを設定します。8. Click Ok to set up the query.

Column
width70%

Calculations

To complete the union query, two calculations will be required;

計算

結合クエリーを完了するには、2つの計算が必要となります:

  1. Label:結合クエリーのロウ(行)を"Cost"ロウ(行)として識別するために使用されます。マスタークエリーで同様の計算が行われ、"Invoiced"としてロウ(行)が識別されます。
  2. Cost:コスト数値を負の値に変換するために使用されます。つまり、小計がレポートに追加されると、コスト金額が請求金額から差し引かれます。
  3. Label: this will be used to identify the rows from the union query as "Cost" rows. There will be a similar calculation in the master query to identify rows as "Invoiced".
  4. Cost: this will be used to convert the cost figure to a negative value. This will mean that when a sub total is added to the report, the cost amount will be subtracted from the invoiced amount.

Label

Section
Column
width30%

514. Click on the + to create a calculated field, in the bottom of the View Fields List panel. ビューフィールド一覧パネルの下部で「+」をクリックし、計算フィールドを作成します。

Column
width70%

Section
Column
width30%

15.計算フィールド名」をLabelに設定します。
注意:このフィールドの名前は任意です。名前が変更されても結合の処理方法は変更されません。

16. ここで示すように、メイン計算パネルでテキストボックスにCostと入力し、「+追加」をクリックして計算式に追加します。

17.テスト」ボタンをクリックして、計算式が正しく作成されたことを確認します。

18.保存」ボタンをクリックして、計算式を完了します。

6. Set the Calculated Field Name to Label
Note: the name for this field can be anything, it will not change the way the union works if it's called something else.

7. Type Cost into the text box under the main calculation panel, as shown here, and click + Add to add it to the calculation.

8. Click the Validate button to ensure your calculation is built correctly.

9. Click the Save button to complete your calculation.

Column
width70%

Cost

Section
Column
width30%

519. Click on the + to create a calculated field, in the bottom of the View Fields List panel.

6. Set the Calculated Field Name to Cost
Note: the name for this field can be anything, it will not change the way the union works if it's called something else.

7. Click on the button.

x. Select the Camp Cost field from the -Select Field- drop down, and click + Add.

x. Close the bracket by clicking ).

x. Click the * button to multiply the field by a value.

x. Type -1 into the text entry field, and click + Add to put in your calculation.

8. Click the Validate button to ensure your calculation is built correctly.

ビューフィールド一覧パネルの下部で「+」をクリックし、計算フィールドを作成します。

20.計算フィールド名」をCostに設定します。
注意:このフィールドの名前は任意です。名前が変更されても結合の処理方法は変更されません。

21. 」ボタンをクリックします。

22.フィールドを選択」ドロップダウンから「Camp Cost」フィールドを選択し、「+追加」をクリックします。

23.) 」をクリックしてカッコを閉じます。

24. 値でフィールドを乗算するには、「 * 」ボタンをクリックします。

25. テキスト入力フィールドに-1と入力して、「+追加」をクリックして計算式に追加します。

26.テスト」ボタンをクリックして、計算式が正しく作成されたことを確認します。

27.保存」ボタンをクリックして、計算式を完了します。9. Click the Save button to complete your calculation.

Column
width70%

...

結合の設定

Section
Column
width30%

28.マスタークエリーフィールド」の「Camp Region」の横の「サブクエリーフィールド」に、「Camp Region」をドラッグします。

29.マスタークエリーフィールド」の「Label」の横の「サブクエリーフィールド」に、計算フィールドの「Label」をドラッグします。

30.マスタークエリーフィールド」の「Sum Invoiced Amount」の横の「サブクエリーフィールド」に、計算フィールドの「Cost」をドラッグします。

31. サブクエリーの名前をCostに変更して、「保存」をクリックして結合を完了します。

10. Drag the Camp Region field into the Sub Query Fields list, directly next to the Camp Region field in the Master Query Fields list.

10. Drag the Label calculated field into the Sub Query Fields list, directly next to the Label field in the Master Query Fields list.

10. Drag the Cost calculated field into the Sub Query Fields list, directly next to the Sum Invoiced Amount field in the Master Query Fields list.

Change the name of the Sub Query to Cost and click Save to complete the Union.

Column
width70%

...

設定の編集

Section
Column
width30%

16. If you need to make changes to your sub query setup at all, click the Edit Settings link.32. 全体的にクエリー設定を変更する必要がある場合は、「設定の編集」リンクをクリックします。

Column
width70%

...

書式

Styleclass
ClasstopLink

topページトップ

Section
Column
width30%

23. Click on the first 33.Sum Invoiced Amount field's drop down list and select Format. 」フィールドのドロップダウンリストをクリックして、「集約の合計」を適用します。

Column
width70%

Image RemovedImage Added

Section
Column
width30%

34.Camp Region」フィールドのドロップダウンリストをクリックして、「書式」を選択します。メインナビゲーションバーから、「カラム(列)の書式」メニューを選択することもできます。

35.重複表示の排除」オプションを有効化します。これにより、最終的な表に小計が組み込まれて、表がより読みやすくなります。

Column
width70%

Image Added

Section
Column
width30%

36.Camp Region」フィールドが表示されているときに、「サマリー」設定を開いて「小計」オプションを有効化します。24. Change the Display name to Invoiced 2014. It's important to do this to provide the user with some context to help differentiate between the queries.

Column
width70%

Image RemovedImage Added

Section
Column
width30%

37.カラム(列)の書式」メニューが表示されているときに、左側の一覧から「Sum Invoiced Amount」フィールドを選択します。

36. 名前をValueに設定します。

Column
width70%

Image Added

Section
Column
width30%

38. メニューを閉じます。

25. While still in the Column Formatting menu, select the Sum Invoiced Amount field from the list on the left.

26. Set the name to Invoiced 2013 and close the menu.

Column
width70%

Image RemovedImage Added

...

保存

Styleclass
ClasstopLink

topページトップ

Section
Column
width30%

27. Click Report > Save to activate your report.39.レポート」>「保存」をクリックして、レポートを有効化します。

Column
width70%

Image RemovedImage Added

Section
Column
width30%

28. Set the Name of your report to Append 40. レポートの名前Union Sub Query Tutorial.に設定します。

29. Set the Description to 41. 説明This report was written using the Sub Query Tutorial.に設定します。

3042. Select Tutorial as the Category.

31. Select Training as the Sub Category.

カテゴリーは「Tutorial」を選択します。

43. サブカテゴリーは「Training」を選択します。

44.有効化」をクリックして終了します。32. Click Activate to finish.

Column
width70%

Image RemovedImage Added

Section
Column
width30%

33. You now have an active Append Sub Query report.45. これで、結合サブクエリーレポートが作成できました。

Column
width70%

Image RemovedImage Added



horizontalrule
Styleclass
ClasstopLink

topページトップ