You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This multi-part tutorial covers the creation of a new data source extension for Power Query. The tutorial is meant to be done sequentially—each lesson builds on the connector created in previous lessons, incrementally adding new capabilities to your connector.
14
14
15
-
In this lesson, you will:
15
+
In this lesson, you:
16
16
17
17
> [!div class="checklist"]
18
18
> * Create a navigation table for a fixed set of queries
19
19
> * Test the navigation table in Power BI Desktop
20
20
21
-
This lesson adds a navigation table to the TripPin connector created in the [previous lesson](../2-rest/readme.md). When your connector used the `OData.Feed` function ([Part 1](../1-odata/readme.md)), you received the navigation table “for free”, as derived from the OData service’s $metadata document. When you moved to the `Web.Contents` function ([Part 2](../2-rest/readme.md)), you lost the built-in navigation table. In this lesson, you take a set of fixed queries you created in Power BI Desktop and add the appropriate metadata for Power Query to popup the **Navigator** dialog for your data source function.
21
+
This lesson adds a navigation table to the TripPin connector created in the [previous lesson](../2-rest/readme.md). When your connector used the `OData.Feed` function ([Part 1](../1-odata/readme.md)), you received the navigation table "for free," as derived from the OData service’s $metadata document. When you moved to the `Web.Contents` function ([Part 2](../2-rest/readme.md)), you lost the built-in navigation table. In this lesson, you take a set of fixed queries you created in Power BI Desktop and add the appropriate metadata for Power Query to popup the **Navigator** dialog for your data source function.
22
22
23
-
See the [Navigation Table documentation](../../../handling-navigation-tables.md) for more information about using navigation tables.
23
+
Go to the [Navigation Table documentation](../../../handling-navigation-tables.md) for more information about using navigation tables.
24
24
25
25
## Defining fixed queries in the connector
26
26
27
-
A simple connector for a REST API can be thought of as a fixed set of queries, each returning a table. These tables are made discoverable through the connector’s navigation table. Essentially, each item in the navigator is associated with a specific URL and set of transformations.
27
+
A simple connector for a REST API can be thought of as a fixed set of queries, each returning a table. These tables are made discoverable through the connector's navigation table. Essentially, each item in the navigator is associated with a specific URL and set of transformations.
28
28
29
29
You start by copying the queries you wrote in Power BI Desktop (in the previous lesson) into your connector file. Open the TripPin project in Visual Studio Code, and paste the Airlines and Airports queries into the TripPin.pq file. You can then turn those queries into functions that take a single text parameter:
30
30
@@ -56,7 +56,7 @@ GetAirportsTable = (url as text) as table =>
56
56
#"Changed Type";
57
57
```
58
58
59
-
Next you'll import the mock navigation table query you wrote that creates a fixed table linking to these data set queries. Call it `TripPinNavTable`:
59
+
Next you need to import the mock navigation table query you wrote that creates a fixed table linking to these data set queries. Call it `TripPinNavTable`:
60
60
61
61
```powerquery-m
62
62
TripPinNavTable = (url as text) as table =>
@@ -80,15 +80,15 @@ shared TripPin.Contents = Value.ReplaceType(TripPinNavTable, type function (url
80
80
```
81
81
82
82
> [!NOTE]
83
-
> Your extension can mark multiple functions as `shared`, with or without associating them with a `DataSource.Kind`. However, when you associate a function with a specific `DataSource.Kind`, each function **must** have the same set of *required* parameters, with the same name and type. This is because the data source function parameters are combined to make a 'key' used for looking up cached credentials.
83
+
> Your extension can mark multiple functions as `shared`, with or without associating them with a `DataSource.Kind`. However, when you associate a function with a specific `DataSource.Kind`, each function **must** have the same set of *required* parameters, with the same name and type. This requirement exists because the data source function parameters are combined to make a 'key' used for looking up cached credentials.
84
84
85
85
Build your connector after finalizing all the changes and test your `TripPin.Contents` function using the TripPin.query.pq file. You can continue to use the previously created credential or you can set a new one and then evaluate your current Power Query file.
:::image type="content" source="../../media/trippin3-table.png" alt-text="Screenshot of the PQTest result with the output of the modified connector.":::
92
92
93
93
## Creating a navigation table
94
94
@@ -109,22 +109,23 @@ TripPinNavTable = (url as text) as table =>
109
109
```
110
110
111
111
Running your test query again, after building your connector again, gives you a similar result as last time—with a few more columns added.
:::image type="content" source="../../media/trippin3-table2.png" alt-text="Screenshot of the PQTest result with the output containing a number of new rows.":::
113
114
114
115
> [!NOTE]
115
116
> You don't see the **Navigator** window appear in the PQTest result window of Visual Studio Code. The **M Query Output** window always displays the underlying table.
116
117
117
118
If you copy your extension over to your Power BI Desktop custom connector and invoke the new function from the **Get Data** dialog, your navigator appears.
:::image type="content" source="../../media/trippin3-nav.png" alt-text="Screenshot of the Navigator dialog with the results of the new function displayed.":::
120
121
121
-
If you right select on the root of the navigation tree and select **Edit**, you see the same table as you did within Visual Studio.
122
+
If you right select the root of the navigation tree and select **Edit**, the same table as appeared in Visual Studio is displayed.
122
123
123
-

124
+
:::image type="content" source="../../media/trippin3-query.png" alt-text="Screenshot of the Power Query editor displaying the same table as in the previous PQTest result.":::
124
125
125
126
## Conclusion
126
127
127
-
In this tutorial, you added a [Navigation Table](../../../handlingnavigationtables.md) to your extension. Navigation Tables are a key feature that makes connectors easier to use. In this example your navigation table only has a single level, but the Power Query UI supports displaying navigation tables that have multiple dimensions (even when they're ragged).
128
+
In this tutorial, you added a [Navigation Table](../../../handlingnavigationtables.md) to your extension. Navigation Tables is a key feature that makes connectors easier to use. In this example, your navigation table only has a single level, but the Power Query UI supports displaying navigation tables that have multiple dimensions (even when they're ragged).
0 commit comments