Forum Discussion

LukasThiago's avatar
LukasThiago
Frequent Visitor
3 years ago

How do I change the name of the navigation table folder?

Hi, I'm developing a custom connector and I have a function with 2 parameters, the access token and the list of the tables.


But in the navigation table, the name of the "folder" is the access token, and I need to change, but I don't know how. Someone can help me?

 

5 Replies

    • LukasThiago's avatar
      LukasThiago
      Frequent Visitor

      Sure, this is basically the main part of my code

      [DataSource.Kind="BaseB", Publish="BaseB.Publish"]
      shared BaseBNavTable = Value.ReplaceType(NavTable, BaseBType);
      
      BaseBType = type function (
          token as (type text meta [
              DataSource.Path = false,
              Documentation.FieldCaption = "Token",
              Documentation.SampleValues = {"zu1UBNRAn1a..."}
          ]),
          tables as (type list meta [
              Documentation.FieldCaption = "Tables",
              Documentation.AllowedValues = RootEntities
          ])
      ) as text meta [
          Documentation.Name = "Base-B"
      ];
      
      NavTable = (token as text, tables as list) as table =>
          let
              entitiesAsTable = Table.FromList(tables, Splitter.SplitByNothing()),
              rename = Table.RenameColumns(entitiesAsTable, {{"Column1", "Name"}}),
              withData = Table.AddColumn(rename, "Data", each BaseB.Feed(Uri.Combine(BaseUrl, [Name]), token), Uri.Type),
              navTable = Table.ToNavigationTable(withData, {"Name"}, "Name", "Data")
          in
              navTable;
      
      BaseB.Feed = (url as text, token as text) =>
          let
              header = [
                  Authorization = "Bearer " & token
              ],
              result = getData(url, header, 20000, 0)
          in
              result;
      • Anonymous's avatar
        Anonymous
        Not applicable

        HI LukasThiago,

        I think you should modify the 'Documentation.FieldCaption' and 'Documentation.SampleValues' parts which used to define the 'token' option of your data connector.

        [DataSource.Kind="BaseB", Publish="BaseB.Publish"]
        shared BaseBNavTable = Value.ReplaceType(NavTable, BaseBType);
        
        BaseBType = type function (
            token as (type text meta [
                DataSource.Path = false,
                Documentation.FieldCaption = "FolderPath",
                Documentation.SampleValues = {"x:\..."}
            ]),
            tables as (type list meta [
                Documentation.FieldCaption = "Tables",
                Documentation.AllowedValues = RootEntities
            ])
        ) as text meta [
            Documentation.Name = "Base-B"
        ];
        
        NavTable = (token as text, tables as list) as table =>
            let
                entitiesAsTable = Table.FromList(tables, Splitter.SplitByNothing()),
                rename = Table.RenameColumns(entitiesAsTable, {{"Column1", "Name"}}),
                withData = Table.AddColumn(rename, "Data", each BaseB.Feed(Uri.Combine(BaseUrl, [Name]), token), Uri.Type),
                navTable = Table.ToNavigationTable(withData, {"Name"}, "Name", "Data")
            in
                navTable;
        
        BaseB.Feed = (url as text, token as text) =>
            let
                header = [
                    Authorization = "Bearer " & token
                ],
                result = getData(url, header, 20000, 0)
            in
                result;

        Regards,

        Xiaoxin Sheng