Forum Discussion
Generate a Custom Navigation Table with List.Generate
- 4 years ago
Here is a proof of concept for the child level
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTJUitWBsIzgLGM4ywTMcgKpM0AwDRFMIwTTGMFE0maqFBsLAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t]), #"Added Custom" = Table.AddColumn(Source, "Custom", each #table({"Name","Key","Data","ItemKind","ItemName","IsLeaf"},{{[Column2],{[Column2]},"your function here " & [Column2],"Table",[Column2],true}})), #"Grouped Rows" = Table.Group(#"Added Custom", {"Column1"}, {{"Group", each _, type table [Custom=table]}}), #"Added Custom1" = Table.AddColumn(#"Grouped Rows", "Children", each Table.Combine([Group][Custom])) in #"Added Custom1"You would still need to call the NavTable function on the "Children" tables and then on the "Column1" tables to tie it together, but you can already see the dynamic approach.
For the source data should I assume a two column table with a mild hierarchy, say one parent has 5 children and the other 12 ?
Yes it will all be dynamic and changing, So for example how I call CreateNavTable(0). I will be putting a parameter so for example if I have 50 sub tables that I need the function will read "CreateNavTable(0 , 50)"
- lbendlin4 years agoSuper User
I was more thinking along the lines of "here's a table with a bit of hierarchy, make a nav table (of nav tables) out of it"
Like this
- JackSoderstrom4 years agoHelper I
Yeah that should work. Here is the example of 12 hard-coded in.
- lbendlin4 years agoSuper User
the icons for your top and next levels should be folder, no? I think you didn't specify ItemKind accordingly. Should be Folder>Folder>Table (or something else for the top level)
Handling navigation for Power Query connectors | Microsoft Docs