Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi Everyone,
I have a requirement where I have to achieve n-level folder structure in dynamic navigation tables, so the content of Dynamic navigation Table will comes from different- different API calls, once reach to a level.
Let me elaborate,
1. Step 1- I am able to receive data from API response, and I am able to render the Navigation Table of very 1st level, but using a static approach, which is not the way I want. Refer the below code:
objects = #table(
{"Name", "Key", "Data", "ItemKind", "ItemName", "IsLeaf"},{
{#"Expanded Column1"{0}[Column1.name], "n1", CreateNavTable("BBB"), "Folder", "Folder", false},
{#"Expanded Column1"{1}[Column1.name], "n2", CreateNavTable("BBB"), "Folder", "Folder", false}
}),
Above you can see I am passing 0, 1 as index value to get the name, I would like to iterate in a dynamic approach manner.
2. Step 2 - After expanding the 1st level the user will be able to see the child level, let's call it as 2nd level. Yes, second level data also comes from a different API call. To make it explain in more details, let's say 1st level navigation table data comes from a API, see below:
Base URL - http://abc.com/api/v1/
1st level API - http://abc.com/api/v1/fs
2nd level API - http://abc.com/api/v1/fs + Parent folder name
Refer to the below attached image for more reference, Here 1st Level is Private and Shared, to get the 2nd level data you need perform API calls, so in this case (http://abc.com/api/v1/fs/private or http://abc.com/api/v1/fs/shared), similarly you have to keep calling APIs call for next level child data and render those in navigation table, and you need to keep perform API calls till you reached to your last level. Also the rendering UI of the navigation folder is dynamic, I can't pass the static index value.
I am new to this program language, so don't have much knowledge how to achieve this. Please advise me here, I am happy to have a working session or I can share my connector piece of code.
Thank you in advance.
Best Regards,
Jyotiraditya
+91 9663659623
Solved! Go to Solution.
Just change the defination of CreateNavTable to include what you need:
CreateNavTable = (entry as record) as table =>
let
subItems = entry[Children],
objects = #table(
{"Name", "Key", "Data", "ItemKind", "ItemName", "IsLeaf"},List.Transform(subItems, each
let isLeaf = Text.EndsdWith([Name], "/")
in {[ItemName], [Name], if isLeaf then CreateTableFromPath(entry[Path]& [Name]) else @CreateNavTable(ListEntries(entry[Path] & [Name])), "Table", "Table", isleaf}
),
NavTable = Table.ToNavigationTable(objects, {"Key"}, "Name", "Data", "ItemKind", "ItemName", "IsLeaf")
in
NavTable;
In this example I rely on 2 additional functions which needs to be implemented:
CreateTableFromPath(text) - Provides the table for the leaf item in the rue
ListEntries(text) - Gets a record for the children in the form:
[Name] - Simple name of the item
[Path] - Full url path of the item
Also, note that this example changes CreateNavTable to take in a [Name = ..., Path = ...] entry.
Note: Use the @ to make a recursive function call.
Just change the defination of CreateNavTable to include what you need:
CreateNavTable = (entry as record) as table =>
let
subItems = entry[Children],
objects = #table(
{"Name", "Key", "Data", "ItemKind", "ItemName", "IsLeaf"},List.Transform(subItems, each
let isLeaf = Text.EndsdWith([Name], "/")
in {[ItemName], [Name], if isLeaf then CreateTableFromPath(entry[Path]& [Name]) else @CreateNavTable(ListEntries(entry[Path] & [Name])), "Table", "Table", isleaf}
),
NavTable = Table.ToNavigationTable(objects, {"Key"}, "Name", "Data", "ItemKind", "ItemName", "IsLeaf")
in
NavTable;
In this example I rely on 2 additional functions which needs to be implemented:
CreateTableFromPath(text) - Provides the table for the leaf item in the rue
ListEntries(text) - Gets a record for the children in the form:
[Name] - Simple name of the item
[Path] - Full url path of the item
Also, note that this example changes CreateNavTable to take in a [Name = ..., Path = ...] entry.
Note: Use the @ to make a recursive function call.
Hi @jyotiraditya ,
Sorry for that, I only can achieve this according this document. We are not very good at developing custom connector. I find that a few threads about this have resolved by @artemus. Maybe he can help you a lot.
Hi @artemus ,
Could you please look into this scenario and give some help? Thanks in advance.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
99 | |
82 | |
70 | |
60 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |