Hello,
I am hoping someone would be able to help me out or point me in the right direction. I am newer to PowerBI and have written a new connector which is working flawlessly. However, there has been a new requirement and I am struggling to find a way to create this solution in PowerBI.
Basically, I am connecting to an API and downloading tables of information. One of the tables includes a list of ORGINIZATIONAL GROUPS in the system. The issue is is there are effectively nested tables (but have to make indvidual API calls to get them). Here is my code so far....
DoceboBranches = (url as text) as table =>
let
orgchart = GetPage("https://<myapi>.com/manage/v1/orgchart"),
withurl = Table.AddColumn(orgchart, "usersUrl", each "https://<myapi>.com/manage/v1/orgchart/"&[id]&"/users", type text),
response = Table.AddColumn(withurl, "userTable", each Docebo.Feed([usersUrl]), type table)
in
response;
STEP 1 (orgchart and wirturl): Get the master ORGCHART table and build links, download each link/orgchart table (which includes all Users accociated with that org which is located in userTable).
The above code yields the folling table:
![2019-05-01 10_54_44-Docebo - Microsoft Visual Studio.png 2019-05-01 10_54_44-Docebo - Microsoft Visual Studio.png]()
STEP 2: This is the part where I am struggling at to do programatically.
For each record/row; IF HASCHILDREN is EQUAL TO "True" then take the ID from the table, build a URL, and pass it into my GetPage funtion. I would also like to loop this as some of these are 3-4 layers deep.
For example, because ID 8 hashchildren, I need to download another table: https://<myapi>.com/manage/v1/orgchart?node_id=8 which returns:![2019-05-01 11_13_17-Docebo - Microsoft Visual Studio.png 2019-05-01 11_13_17-Docebo - Microsoft Visual Studio.png]()
Once this is returned, I would like to add the IDs to the usersUrl and download these user tables as well. However, I am not sure how to even access these rows as records and use these parameters as variables.
STEP 3: Basically (from step 1) I would like to end up with a master table that brings all the nested tables forward:
Example
id | title | haschildren | usersUrl | userTable |
11 | Demo | FALSE | https://<myapi>.com/manage/v1/orgchart/11/users | [Table] |
8 | Employees | TRUE | https://<myapi>.com/manage/v1/orgchart/8/users | [Table] |
2 | Salesforce Contacts | TRUE | https://<myapi>.com/manage/v1/orgchart/2/users | [Table] |
13 | DISYS | FALSE | https://<myapi>.com/manage/v1/orgchart/13/users | [Table] |
10 | Netmetschek | FALSE | https://<myapi>.com/manage/v1/orgchart/10/users | [Table] |
14 | Netmetscheck | FALSE | https://<myapi>.com/manage/v1/orgchart/14/users | [Table] |
9 | TimeXperts | FALSE | https://<myapi>.com/manage/v1/orgchart/9/users | [Table] |
.................and so on...
STEP 4: Once the above is done, I would like a table with ID and TITLE only (from step 3)
STEP 5: THEN take all the users out of the userTables and have one list including only User, User, ID then use the Step 4 table to match the OrgIDs to the name of the Org.
Is anyone able to help me out or point me in the right direction for STEP 2?
Thank You