带动态 MDX 的分析服务的数据访问层

发布于 2024-09-24 12:14:49 字数 914 浏览 2 评论 0原文

我们有一个使用 Analysis Services 作为数据源的项目。为了避免由于我们允许的所有选择选项而必须创建 100 个查询,我们使用大量开关和字符串连接来创建 mdx 查询。这是我们的“数据访问层”。管理起来非常困难,而且最小的错误也是如此:缺少空格、拼写错误很容易被忽略,甚至更容易意外包含在内。有谁知道有什么好的资源可以帮助使其更易于管理,例如教程、白皮书或示例项目。

为了让您了解我正在谈论的案例逻辑,它一直在继续...... if (时间 == 天) { if(年==一) { return (" MEMBER " + 当前销售额百分比 + " AS ([销售额 % " + YearString + " " + StatusType + "]) "); } 否则//2年 { return (" MEMBER " + 当前销售额百分比 + " AS ([销售额 % 2Y " + StatusType + "]) "); } } else if (时间 == 周) { if(年==一) { return (" MEMBER " + 当前销售额百分比 + " AS ([销售额 WTD % " + YearString + " " + StatusType + "]) "); } 否则//2年 { return (" MEMBER " + 当前销售额百分比 + " AS ([销售额 WTD % 2Y" + StatusType + "]) "); } ...

老实说,我也不确定所有不同的测量和计算是否正确。但是,这是由另一个团队控制的,所以我们在这里的影响力要小一些。

谢谢! 市场

We have project that uses Analysis Services as it's datasource. To try to avoid having to create 100's of queries because of all the selection options we allow, we create our mdx queries with alot of switches and string concatenation. This is our "Data Access Layer". It is a beast to manage and the smallest mistake: missing spaces, mispellings are easy to miss and even easier to accidently include. Does anyone know of a good resource that can help make this more manageable, like a tutorial, white paper or sample project.

To give you an idea of the case logic I'm talking about and it goes on and on...
if (Time == Day)
{
if (Years == One)
{
return (" MEMBER " + CurrentSalesPercent +
" AS ([Sales % " + YearString + " " + StatusType + "]) ");
}
else //2Y
{
return (" MEMBER " + CurrentSalesPercent +
" AS ([Sales % 2Y " + StatusType + "]) ");
}
}
else if (Time == Week)
{
if (Years == One)
{
return (" MEMBER " + CurrentSalesPercent +
" AS ([Sales WTD % " + YearString + " " + StatusType + "]) ");
}
else //2Y
{
return (" MEMBER " + CurrentSalesPercent +
" AS ([Sales WTD % 2Y " + StatusType + "]) ");
}
...

To be honest, I'm not sure if all the different measures and calculations are correct either. But, that's controlled by another team, so we have a little less influence here.

Thanks!
mkt

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

蓝咒 2024-10-01 12:14:49

您看过 MS 生成 MDX 的方式吗?如果您安装了 SSRS,请获取“Red Gate Reflector”并反汇编 C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportServer\bin\MDXQueryGenerator.dll

除此之外,带有参数的预装查询似乎相当标准:(

Have you looked at the way MS generates MDX? If you have SSRS installed, get "Red gate Reflector" and disassemble C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportServer\bin\MDXQueryGenerator.dll

Apart from that, pre-canned queries that take parameters seems pretty standard :(

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文