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.
Hello,
I am trying to build a data connector for our budgeting software to connect with Power BI. I have successfully be able to execute api calls but I am struggling to get the data connector to work. So far I have gotten to step 3 in the Tripin tutorial. https://docs.microsoft.com/en-us/power-query/samples/trippin/3-navtables/readme . My code is below for the implementation.
//
// Implementation
//
[DataSource.Kind="Adaptive"]
shared Adaptive.Feed = Value.ReplaceType(AdaptiveImpl, type function (url as Uri.Type) as any);
[DataSource.Kind="Adaptive", Publish="Adaptive.Publish"]
shared Adaptive.Contents = Value.ReplaceType(AdaptiveNavTable, type function (url as Uri.Type) as any);
AdaptiveImpl =(url as text) =>
let
source = Web.Contents(url),
xml = Xml.Tables(source)
in
xml;
AdaptiveNavTable = (url as text) as table =>
let
source = #table({"Name", "Data", "ItemKind", "ItemName", "IsLeaf"}, {
{"Sheets", GetSheetsTable(url), "Table", "Table", true}
}),
navTable = Table.ToNavigationTable(source, {"Name"}, "Name", "Data", "ItemKind", "ItemName", "IsLeaf")
in
navTable;
GetSheetsTable = (url as text) as table =>
let
source = Adaptive.Feed(url),
output = source{0}[output],
sheets = output{0}[sheets],
#"Unpivoted Columns" = Table.UnpivotOtherColumns(sheets, {}, "Attribute", "Value"),
#"Expanded Value" = Table.ExpandTableColumn(#"Unpivoted Columns", "Value", {"Attribute:id", "Attribute:name", "Attribute:prefix", "Attribute:description", "Attribute:isGlobal", "Attribute:recalculateOnDemand"}, {"Value.Attribute:id", "Value.Attribute:name", "Value.Attribute:prefix", "Value.Attribute:description", "Value.Attribute:isGlobal", "Value.Attribute:recalculateOnDemand"}),
#"Removed Columns" = Table.RemoveColumns(#"Expanded Value",{"Value.Attribute:description", "Value.Attribute:isGlobal", "Value.Attribute:recalculateOnDemand"}),
#"Reordered Columns" = Table.ReorderColumns(#"Removed Columns",{"Value.Attribute:id", "Value.Attribute:name", "Value.Attribute:prefix", "Attribute"})
in
#"Reordered Columns";
In order to call the api, I need to pass the Contents to the Web.Contents function. There is an example below of what I am doing.
source = Web.Contents(url, [Contents=Extension.Contents("exportSheets.xml")])
For each endpoint request, I will have to pass a different xml file to call the api. I am struggling with how to include this in the custom data connector. I highlighted sections above that I believe need to be edited, I am just not sure what to do.
I thought I needed to pass a different two variables to the AdaptiveImpl but when trying to do this I have continued to get errors.
Any help would be greatly appreciated.
Thanks,
Hi @rsimcoe ,
To be honest, I am not an expert of this. Hope other super user can help you.
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.