带动态 MDX 的分析服务的数据访问层
我们有一个使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您看过 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 :(