Forum Discussion
Custom Connector display an individual datasource name
- 5 months ago
Thankyou, Juan-Power-bi for your response.
Hi mabr,Based on our understanding, the behavior you are observing may be attributed to how Power Query determines the data source identity for custom connectors. Although you have correctly set DataSource.Path = false, this metadata only affects credential scoping and does not govern what appears as the Navigator root label. When a connector accepts a dynamic parameter such as a URL and uses it to establish the connection, Power Query may still infer the data source path from that endpoint. Consequently, the Navigator displays http://localhost:55561 as the root node.
If a fixed root label such as customCo is required, the connector would need to expose a parameter less entry function and handle the URL internally, rather than using it in the data source function signature.
If the capability to override the Navigator root label while continuing to use a dynamic URL parameter would be useful for your scenario, we kindly request you to raise an idea in the Ideas Forum using the following link:
Fabric Ideas - Microsoft Fabric CommunityAdditionally, please refer to the following links:
Handling Data Access - Power Query | Microsoft Learn
Handling authentication for Power Query connectors - Power Query | Microsoft LearnWe hope the information provided helps to resolve the issue. Should you have any further queries, please feel free to contact the Microsoft Fabric community.
Thank you.
The issue is how Power BI determines the datasource path. DataSource.Path = false on a function parameter only hides that parameter from the credential path — but since url is your only parameter, Power BI still needs something to identify the datasource kind, and it falls back to showing the URL.
The fix is to move the URL out of the function signature and into the credential itself by using a datasource function with no path parameters. The trick is declaring the DataSource.Kind with no parameters at all, and accepting the URL inside the function body instead:
m[DataSource.Kind="customCo.Auth", Publish="customCo.Publish"]
shared customCo = Value.ReplaceType(customCoImpl, customCoType);
customCoType = type function (
url as (type text meta [
Documentation.FieldCaption = "customCo URL",
Documentation.FieldDescription = "some text",
Documentation.SampleValues = {"https://host.domain.com"}
])
) as any;
customCoImpl = (url as text) =>
let
result = customCoNavTable(url)
in
result;
customCo.Auth = [
Label = "customCo",
Authentication = [
UsernamePassword = [
UsernameLabel = "Username",
PasswordLabel = "Password",
Label = "customCo"
]
],
// This is the key part — empty datasource path
TestConnection = (dataSourcePath) => {"customCo"}
];
The real key is making sure none of your function parameters contribute to the datasource path. You do that by marking ALL parameters with DataSource.Path = false:
mcustomCoType = type function (
url as (type text meta [
DataSource.Path = false, // <-- must be here
Documentation.FieldCaption = "customCo URL"
])
) as any;
When every parameter has DataSource.Path = false, the credential key becomes just the connector kind name (customCo.Auth) with no path component — which is exactly what gives you the clean fixed label. If the URL is still showing up despite that, double-check you're not accidentally inheriting a path from a nested Web.Contents or similar call that has its own datasource registration.
Hi Juan,
thanks for your answer, but no matter what I try it doesn´t work. I have cut down my code to a minimal version:
section customCo;
[DataSource.Kind="customCo.Auth", Publish="customCo.Publish"]
shared customCo = Value.ReplaceType(customCoImpl, customCoType);
customCoType = type function (
url as (type text meta [
DataSource.Path = false,
Documentation.FieldCaption = "customCo URL",
Documentation.FieldDescription = "some text",
Documentation.SampleValues = {"https://host.domain.com"}
])
) as any;
customCoImpl = (url as text) =>
let
result = customCoNavTable(url)
in
result;
customCo.Auth = [
Label = "customCo",
Authentication = [
UsernamePassword = [
UsernameLabel = "Username",
PasswordLabel = "Password",
Label = "customCo"
]
],
TestConnection = (dataSourcePath) => {"customCo"}
];
customCo.Publish = [
Category = "Database",
ButtonText = { "customCo", "customCo" }
];
Table.ToNavigationTable = (
table as table,
keyColumns as list,
nameColumn as text,
dataColumn as text,
itemKindColumn as text,
itemNameColumn as text,
isLeafColumn as text
) as table =>
let
tableType = Value.Type(table),
newTableType = Type.AddTableKey(tableType, keyColumns, true) meta
[
NavigationTable.NameColumn = nameColumn,
NavigationTable.DataColumn = dataColumn,
NavigationTable.ItemKindColumn = itemKindColumn,
Preview.DelayColumn = itemNameColumn,
NavigationTable.IsLeafColumn = isLeafColumn
],
navigationTable = Value.ReplaceType(table, newTableType)
in
navigationTable;
customCoNavTable = (baseUrl as text) as table =>
let
FallbackTable = Table.FromRows({}, {}),
ToNavItems = (list) =>
let
result = List.Transform(list, each
[
Key = _[key],
Name = _[name],
ItemKind = _[type],
ItemName = _[name],
IsLeaf = true,
Data = FallbackTable
]
)
in
result,
values = {
[key="item1", name="item1name", type="Folder"],
[key="item2", name="item2name", type="File"]
},
rootTable = Table.FromRecords(ToNavItems(values)),
nav = Table.ToNavigationTable(
rootTable,
{"Key"},
"Name",
"Data",
"ItemKind",
"ItemName",
"IsLeaf"
)
in
nav;
Why does it still show the URL in the Navigator?