Power BI自定义连接器记录未发生

时间:2018-10-02 14:32:44

标签: powerbi powerquery powerbi-desktop

我正在Visual Studio 2017中创建Power BI自定义连接器,我希望它在开发期间记录下来。

我在示例中,尤其是在diagnostics下的TripPin示例中,都遵循了这种方法。

诊断帮助程序文件Diagnostics.pqm已加载到我的.pq文件中:

Extension.LoadFunction = (name as text) =>
    let
        binary = Extension.Contents(name),
        asText = Text.FromBinary(binary)
    in
        Expression.Evaluate(asText, #shared);

// Diagnostics module contains multiple functions. We can take the ones we need.
Diagnostics = Extension.LoadFunction("Diagnostics.pqm");
Diagnostics.LogValue = if (EnableTraceOutput) then Diagnostics[LogValue] else (prefix, value) => value;

EnableTraceOutput设置为true,而Diagnostics.pqm文件设置为“ Compile”。在项目属性中,“显示用户跟踪”是正确的。

我已经引用了该函数:

shared GetSomeData = (test as logical, systemfolder as text) as table =>
    let
        #"SystemFolder" = Text.Trim(Text.Clean(systemfolder)),
        #"connstring" = "Provider=myprovider;Data Source=" & AddBs(#"SystemFolder") 
            & "seqco.dbf;Collating Sequence=machine;",
        _connstring = Diagnostics.LogValue("Conn String", #"connstring"),
        #"query" = "select stuff from table",
        data = OleDb.Query(#"connstring", #"query")
in
    data;

该函数已执行并返回数据,但据我所知,没有任何记录。

1 个答案:

答案 0 :(得分:0)

典型的,需要正确地阅读该死的例子,应该这样调用它,在OleDb.Query()中使用_connstring会强制它求值:

shared GetSomeData = (test as logical, systemfolder as text) as table =>
    let
        #"SystemFolder" = Text.Trim(Text.Clean(systemfolder)),
        #"connstring" = "Provider=myprovider;Data Source=" & AddBs(#"SystemFolder") 
            & "seqco.dbf;Collating Sequence=machine;",
        _connstring = Diagnostics.LogValue("Conn String", #"connstring"),
        #"query" = "select stuff from table",
        data = OleDb.Query(_connstring, #"query")
in
    data;
相关问题