Forum Discussion
Functions in Navigation Tables for Power BI Custom Connector
- Anonymous1 year ago
Hi petrbroz ,
Yes, this is the expected behavior when a function in a custom connector does not require any parameters. When you click the function in the navigation pane, Power BI will display a message indicating that no parameter values are specified because the function does not need any input from the user. This is a standard message to show that there are no parameters to pass for the function when you invoke it.
Best Regards
Hi petrbroz ,
The message "No parameter values specified" typically appears when a function expects parameters but none are provided. Please check if the function define any unexpected parameter, update the codes below for the function TestFunction and TestFunctionType:
TestFunction = () as table =>
let
result = #table({"Column1", "Column2"}, {{"Test Function A", "Default Message"}})
in
result;TestFunctionType = type function () as table meta
[
Documentation.Name = "Test Function",
Documentation.LongDescription = "Function description..."
];
Best Regards
- petrbroz1 year agoNew Member
Thank you for the suggestion Anonymous. Unfortunately that doesn't solve the issue. Please note that the function I'm trying to access in Power BI is AnotherFunction.Contents which is already without any parameters.
Btw. I've also tested the official sample: https://github.com/microsoft/DataConnectors/blob/master/samples/NavigationTable without any modifications, and I get the same message, so I'm wondering if this is the expected behavior?
- Anonymous1 year agoNot applicable
Hi petrbroz ,
Yes, this is the expected behavior when a function in a custom connector does not require any parameters. When you click the function in the navigation pane, Power BI will display a message indicating that no parameter values are specified because the function does not need any input from the user. This is a standard message to show that there are no parameters to pass for the function when you invoke it.
Best Regards
- petrbroz1 year agoNew Member
Thank you Anonymous. After some more research I've found that Power BI shows a slightly different message depending on whether the function accepts any parameters:
- If the function accepts no parameters, Power BI shows "No parameter values specified"
- If the function accepts parameters (doesn't matter whether it's documented or not), Power BI shows "Parameter value not specified"
I think the naming is a bit misleading. Also, it would be nice if the behavior was:
- If the function accepts no parameters, Power BI shows the results of calling the function
- If the function accepts parameters, Power BI shows UI to input these parameters (just like it does for the top level function), and then shows the results based on the provided inputs
.
Source code:
[Version = "1.0.0"] section TestConnector; TestConnector = [ Authentication = [ Anonymous = [] ] ]; TestConnector.Publish = [ Beta = true, Category = "Other", ButtonText = {"Test Connector", "Test Connector"}, LearnMoreUrl = "https://powerbi.microsoft.com/" ]; [DataSource.Kind="TestConnector", Publish="TestConnector.Publish"] shared TestConnector.Contents = () => let records = { [ Name = "Function with no params", Key = "f1", Data = FunctionWithNoParams, ItemKind = "Function", ItemName = "Function", IsLeaf = true ], [ Name = "Function with params (undocumented)", Key = "f2", Data = FunctionWithParams, ItemKind = "Function", ItemName = "Function", IsLeaf = true ], [ Name = "Function with params (documented)", Key = "f3", Data = Value.ReplaceType(FunctionWithParams, FunctionWithParamsType), ItemKind = "Function", ItemName = "Function", IsLeaf = true ] } in NavigationTable(records); FunctionWithNoParams = () as table => #table( {"Column"}, {{"Foo"}} ); FunctionWithParams = (name as text) as table => #table( {"Name"}, {{name}} ); FunctionWithParamsType = type function ( name as (type text meta [ Documentation.FieldCaption = "My Param Name", Documentation.FieldDescription = "Parameter description..." ]) ) as table meta [ Documentation.Name = "My Function Name", Documentation.LongDescription = "Function description..." ]; NavigationTable = (records as list) as table => let _table = Table.FromRecords(records), tableType = Value.Type(_table), newTableType = Type.AddTableKey(tableType, {"Key"}, true) meta [ NavigationTable.NameColumn = "Name", NavigationTable.DataColumn = "Data", NavigationTable.ItemKindColumn = "ItemKind", Preview.DelayColumn = "ItemName", NavigationTable.IsLeafColumn = "IsLeaf" ] in Value.ReplaceType(_table, newTableType);Since you say this is the expected behavior, I'll accept your solution, and I'll submit my suggestions in https://ideas.fabric.microsoft.com. Thank you!