source ステップ種別プロパティ
sources プロパティを使用して、ステップクエリに columns、groups、filters、および数式を追加します。
| 項目名 | 説明 |
|---|---|
| columns |
ソースの列。詳細は、「columns プロパティ」を参照してください。 |
| groups | |
| filters | ソースの列に適用される条件。詳細は、「filters プロパティ」を参照してください |
| name | データソースの名前。クエリに数式列が含まれている場合、その数式列は name プロパティがない最後のソースとして追加されます。 |
| cogroupType | 別々の name プロパティを持つ複数のデータソースがある場合、このパラメータを使用して、このクエリのブレンドされたデータに含まれるレコードを定義します。cogroupType の有効な値は left、right inner full です。left と right のブレンドがある場合、最初のデータセットまたはブレンドが左ブレンドであるとみなされます。データのブレンドについての詳細は、「1 つのクエリを使用した複数のデータセットの探索」を参照してください。 |
grain クエリ
1"sources": [
2 {
3 "columns": [
4 {
5 "field": "Customer_Name",
6 "name": "Customer_Name"
7 },
8 {
9 "field": "Customer_Segment",
10 "name": "Customer_Segment"
11 },
12 {
13 "field": "Product_Name",
14 "name": "Product_Name"
15 },
16 {
17 "field": "City",
18 "name": "City"
19 },
20 {
21 "field": "Order_ID",
22 "name": "Order_ID"
23 },
24 ],
25 "groups": [],
26 "filters": [],
27 "name": "SuperStoreSales"
28 }
29]グループ化を含まないクエリ
クエリがディメンションでグループ化されていない場合は、groups を ["all"] に設定します。
1"sources": [
2 {
3 "columns": [
4 {
5 "field": ["sum", "Amount"]
6 "name": "A"
7 },
8 ],
9 "groups": ["all"],
10 "filters": [],
11 "name": "SuperStoreSales"
12 }
13]グループ化を含むクエリ
1"sources": [
2 {
3 "columns": [
4 {
5 "field": ["sum", "Amount"]
6 "name": "A"
7 },
8 ],
9 "groups": ["Customer_Segment", "Order_priority"],
10 "filters": [],
11 "name": "SuperStoreSales"
12 }
13]数式列を含むクエリ
1"sources": [
2 {
3 "columns": [
4 {
5 "field": ["sum", "Amount"]
6 "name": "A"
7 },
8 {
9 "formula": "case \nwhen starts_with('Product_Container', \"Small|") then null\nelse count()\nend\n",
10 "name": "B"
11 }
12 ],
13 "filters": [],
14 "groups": [
15 "Order_Priority",
16 "Product_Container"
17 ],
18 "name": "SuperStoreSales"
19 }
20]数式を参照する列を含むクエリ
数式列は、name プロパティを持たない別々のソースで定義されます。
1"sources": [
2 {
3 "columns": [
4 {
5 "field": ["sum", "Amount"]
6 "name": "A"
7 }
8 ],
9 "groups": ["Customer_Segment", "Order_Priority"],
10 "filters": [],
11 "name": "SuperStoreSales"
12 },
13 {
14 "columns": [
15 {
16 "forumula": "A*2",
17 "name": "B"
18 },
19 {
20 "forumula": "B/100",",
21 "name": "C"
22 }
23 ]
24 }
25]複数のデータソースを含むクエリ
1"sources": [
2 {
3 "columns": [
4 {
5 "field": ["avg", "Profit"]
6 "name": "A"
7 }
8 ],
9 "groups": ["City"],
10 "filters": [],
11 "name": "SuperStoreSales",
12 "cogroupType": "left"
13 },
14 {
15 "columns": [
16 {
17 "field": ["sum", "Amount"],
18 "name": "B"
19 }
20 ],
21 "groups": ["City"],
22 "filters": [],
23 "name": "Opportunity"
24 }
25]