0% found this document useful (0 votes)
15 views

Custom Connector

Oracle_Acc

Uploaded by

srikanth
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Custom Connector

Oracle_Acc

Uploaded by

srikanth
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

TripPinConnector.

pq file

// This file contains your Data Connector logic


section TripPinConnector;

[DataSource.Kind="TripPinConnector", Publish="TripPinConnector.Publish"]
shared TripPinConnector.Contents = (optional message as text) =>
let
airports = GetAirports(),
#"Expanded Airport" = Table.ExpandRecordColumn(airports, "Column1",
{"IcaoCode", "Name", "IataCode", "Location"}, {"IcaoCode", "Name", "IataCode",
"Location"}),
#"Expanded Location" = Table.ExpandRecordColumn(#"Expanded Airport",
"Location", {"Address", "City", "Loc"}, {"Address", "City", "Loc"}),
#"Expanded City" = Table.ExpandRecordColumn(#"Expanded Location", "City",
{"CountryRegion", "Name", "Region"}, {"CountryRegion", "Name.1", "Region"}),
#"Expanded Loc" = Table.ExpandRecordColumn(#"Expanded City", "Loc", {"type",
"coordinates", "crs"}, {"type", "coordinates", "crs"}),
#"Extracted Values" = Table.TransformColumns(#"Expanded Loc", {"coordinates",
each Text.Combine(List.Transform(_, Text.From), ","), type text}),
#"Expanded crs" = Table.ExpandRecordColumn(#"Extracted Values", "crs",
{"properties"}, {"properties"}),
airportsDetail = Table.ExpandRecordColumn(#"Expanded crs", "properties",
{"name"}, {"crs"})
in
airportsDetail;

GetAirports = () as table =>


let
DefaultRequestHeaders = [
#"Accept" = "application/json;odata.metadata=minimal",
#"OData-MaxVersion" = "4.0"
],
source =
Web.Contents("https://services.odata.org/v4/TripPinService/Airports",
[ Headers=DefaultRequestHeaders ]),
json = Json.Document(source),
value = json[value],
toTable = Table.FromList(value, Splitter.SplitByNothing(), null, null,
ExtraValues.Error)
in
toTable;

// Data Source Kind description


TripPinConnector = [
Authentication = [
// Key = [],
// UsernamePassword = [],
// Windows = [],
Implicit = []
],
Label = Extension.LoadString("DataSourceLabel")
];

// Data Source UI publishing description


TripPinConnector.Publish = [
Beta = true,
Category = "Other",
ButtonText = { Extension.LoadString("ButtonTitle"),
Extension.LoadString("ButtonHelp") },
LearnMoreUrl = "https://powerbi.microsoft.com/",
SourceImage = TripPinConnector.Icons,
SourceTypeImage = TripPinConnector.Icons
];

TripPinConnector.Icons = [
Icon16 = { Extension.Contents("TripPinConnector16.png"),
Extension.Contents("TripPinConnector20.png"),
Extension.Contents("TripPinConnector24.png"),
Extension.Contents("TripPinConnector32.png") },
Icon32 = { Extension.Contents("TripPinConnector32.png"),
Extension.Contents("TripPinConnector40.png"),
Extension.Contents("TripPinConnector48.png"),
Extension.Contents("TripPinConnector64.png") }
];

TripPinConnector.query.pq file

// Use this file to write queries to test your data connector


let
result = TripPinConnector.Contents()
in
result

You might also like