【问题标题】:Power BI Custom Connector logging not happeningPower BI 自定义连接器日志记录未发生
【发布时间】:2018-10-02 23:12:28
【问题描述】:

我正在 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 文件设置为“编译”。项目属性中的“显示用户跟踪”为真。

我已经引用了函数:

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;

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

【问题讨论】:

    标签: powerbi powerquery powerbi-desktop


    【解决方案1】:

    典型的,需要正确阅读该死的例子,它应该像这样调用,在 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;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-26
      • 2016-04-23
      • 1970-01-01
      • 1970-01-01
      • 2016-08-29
      • 2019-11-15
      相关资源
      最近更新 更多