0
votes

I am writing a custom connector for Power BI and when I try to run my code in Visual Studio I am getting the We are unable to apply indexing to the type Table.

I have a number of other custom connectors written in the same format/syntax which work perfectly fine and the functions they call return the data I need so I am not sure where the issue may lie (I am fairly new to M Language), I also cannot find much about indexing in M language online, other than adding new indexed columns etc in MS Docs, so I'm unsure about where to go from here.

The navigation table looks like:

shared CMS.Contents = () as table =>
let
    aggregate = #table(
        {"Name",                "Key",          "Data",             "ItemKind",         "ItemName",         "IsLeaf"}, {
        {"Locale",              "locales",       GetLocale(),       "Table",            "Locales",           true},
        {"GetChangeRequest",    "changeRequest", GetChangeRequest(),"Table",            "ChangeRequests",    true}
       }),
    NavTable = Table.ToNavigationTable (aggregate {"Key"}, "Name", "Data", "ItemKind", "ItemName", "IsLeaf")
in
   NavTable;

I'm hoping its something fairly obvious if anyone has any ideas?

Thanks!

1

1 Answers

0
votes

In NavTable step the correct syntax is aggregate[Key], it should solve the problem.