微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Power BI分页报告:覆盖默认错误消息

如何解决Power BI分页报告:覆盖默认错误消息

请您提示我,在哪里可以找到结束编辑 Power BI 报告的配置代码(如下)。

目的:覆盖错误消息。

服务器:PowerBI

报告类型:分页报告(SSRS 模拟)

代码来源:article from Microsoft

配置代码

from contextlib import ContextDecorator

class mycontext(ContextDecorator):
    def __enter__(self):
        print('Starting')
        return self

    def __exit__(self,*exc):
        print('Finishing')
        return False

>>> @mycontext()
... def function():
...     print('The bit in the middle')
...
>>> function()
Starting
The bit in the middle
Finishing

>>> with mycontext():
...     print('The bit in the middle')
...
Starting
The bit in the middle
Finishing

https://docs.microsoft.com/en-us/javascript/api/overview/powerbi/override-error-messages

解决方法

没有要编辑的配置。您问题中的文章建议handle the errors yourselfhideErrors: true 表示 Power BI 不会显示错误。然后您必须处理 error 事件并向用户显示一条消息,表明发生了一些事情。将显示什么取决于您。 event 参数中将提供有关实际错误的信息。如果出现错误,它将实现 IError 接口,您可以查看 messagedetailedMessageerrorCode 属性的值来决定向用户显示什么。

report.off("error");
report.on("error",function(event) {
    // Handle errors <-- This is the place,where you must write code to show a message
});

有关在嵌入 Power BI 时如何处理事件的更深入信息,请参阅 How to handle events 文章。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。