Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
274188A
Advocate I
Advocate I

Connector

I amd building a custom PBI Desktop connector with the sdk: 

I have these 2 files:


*.pq

 

section MyConnector;

// Define the data source function
MyConnectorImpl = (Url as text, Token as text) as table =>
let
    actualUrl = Url,
    record = [
        token = Token,
        content = "record",
        format = "csv"
    ],
    body = Text.ToBinary(Uri.BuildQueryString(record)),
    options = [
        Headers = [#"Content-type" = "application/x-www-form-urlencoded"],
        Content = body
    ],
    result = Web.Contents(actualUrl, options),
    #"Imported CSV" = Csv.Document(result, [Delimiter = ",", Encoding = 65001, QuoteStyle = QuoteStyle.Csv]),
    #"Promoted Headers" = Table.PromoteHeaders(#"Imported CSV", [PromoteAllScalars = true])
in
    #"Promoted Headers";

// Define the type for the data source function
MyConnectorType = type function (
    Url as text,
    Token as text
) as table;


*.query.pq

[DataSource.Kind="MyConnector", Publish="MyConnector.Publish"]
shared MyConnector.Contents = Value.ReplaceType(MyConnectorImpl, MyConnectorType);

// Data Source UI publishing description
MyConnector.Publish = [
    Beta = true,
    Category = "Other",
    ButtonText = { "My Connector", "My Connector" },
    LearnMoreUrl = "https://example.com"
];

 

 

My Error:
Afer I build, then evaluate the query file, I see the following:


[1:48:56 PM]    [Info]  Detected a newer mez file, about to infer its latest info. 1720763336064, 1536065
[1:48:56 PM]    [Info]  [Task found] c:\Users\xxxx\.vscode\extensions\powerquery.vscode-powerquery-sdk-0.4.0-win32-x64\.nuget\Microsoft.PowerQuery.SdkTools.2.127.3\tools\PQTest.exe info
                --extension "d:\repos\Power Query Extensions\MyConnector\bin\AnyCPU\Debug\MyConnector.mez"
                --prettyPrint
[1:48:57 PM]    [Debug] onModuleLibraryUpdated: []
[1:48:57 PM]    [Info]  Update last ctime of an inferred mez file to 1720763336064
[1:48:57 PM]    [Info]  DisplayExtensionInfo result MyConnector
[1:48:57 PM]    [Info]  [Task found] c:\Users\xxxxxA\.vscode\extensions\powerquery.vscode-powerquery-sdk-0.4.0-win32-x64\.nuget\Microsoft.PowerQuery.SdkTools.2.127.3\tools\PQTest.exe run-test
                --extension "d:\repos\Power Query Extensions\MyConnector\bin\AnyCPU\Debug\MyConnector.mez"
                --queryFile "d:\repos\Power Query Extensions\MyConnector\MyConnector.query.pq"
                --prettyPrint
[1:48:58 PM]    [Info]  RunTestBattery result [
    {
        "ActivityId": "094ca3e3-75c4-4112-b34a-1d4075ca94b3",
        "DataSourceAnalysis": [],
        "Details": "Token ';' expected. Start position: (3, 1). End position (3, 7).",
        "EndTime": "2024-07-12T05:48:58.4633242+00:00",
        "Method": "PQTest.RunTest",
        "Name": "MyConnector.query.pq",
        "StartTime": "2024-07-12T05:48:58.4429286+00:00",
        "DiagnosticEvents": {},
        "RowCount": 0,
        "Status": "Failed",
        "Type": "PQTest.Expression",
        "Error": {
            "Message": "Token ';' expected. Start position: (3, 1). End position (3, 7)."
        }
    }
]


Any incites appreciated

 

- my thoughts are it's something to do with having 2 input parameters - perhaps not being initialsed correctly when this line is called:

shared MyConnector.Contents = Value.ReplaceType(MyConnectorImpl, MyConnectorType);

1 REPLY 1
Anonymous
Not applicable

Hi @274188A ,

You didn't give the complete code, I'm not sure if the content in your brackets is correct, could you provide the complete code?

vjunyantmsft_0-1721009399619.png

Value.ReplaceType - PowerQuery M | Microsoft Learn

Best Regards,
Dino Tao

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors