如何通过 C# 访问 MDX 输出的元组/单元属性?
我正在使用 Adomd.net 进行 MDX 查询,其中 cmd 包含命令文本。
当直接针对多维数据集运行时,会返回以下输出,只是一个标题和计数整数,这是一个度量:
TrueCount
n
但是,如何通过 c# 访问此度量/元组/数字?
我知道如何获取标题 TrueCount(见下文),但我不知道如何获取开花数字。
//Execute the query, returning a cellset
CellSet cs = cmd.ExecuteCellSet();
//Output the column captions from the first axis
TupleCollection tuplesOnColumns = cs.Axes[0].Set.Tuples;
foreach (var column in tuplesOnColumns)
if (!column.Members[0].Caption.Contains("All"))
truecount.Add(new TrueCount() { CountTitle = column.Members[0].Caption });
任何想法或指示都非常感谢 - 对于这个厚重的问题表示歉意。
I have an MDX query I am pulling through using Adomd.net where cmd contains the command text.
This, when run directly against a cube returns the following output, just a caption and the count integar, this being a measure:
TrueCount
n
However, how do I access this measure/tuple/number through c# ?
I know how I can get the caption, TrueCount out (see below), but I don't know how to get the blooming number out.
//Execute the query, returning a cellset
CellSet cs = cmd.ExecuteCellSet();
//Output the column captions from the first axis
TupleCollection tuplesOnColumns = cs.Axes[0].Set.Tuples;
foreach (var column in tuplesOnColumns)
if (!column.Members[0].Caption.Contains("All"))
truecount.Add(new TrueCount() { CountTitle = column.Members[0].Caption });
Any ideas or pointers greatly appreciated - apologies for the thick question.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我没有使用这些函数来运行 MDX,但我使用 ADOMD 的经验是,行和列的标题是从不同的对象访问到中间的数字的。因此,我认为您需要查看您的
cs
对象,而不是cs.Axes
内的对象。在 ADOMD 中,您只需说
myNumber = cs(x, y).FormattedValue
希望这可以引导您走向正确的方向!
I haven't used these functions to run MDX, but my experience with ADOMD is that the captions of rows and columns are accessed from a different object to the numbers in the middle. So I think you need to look at your
cs
object, and not withincs.Axes
.In ADOMD you just say
myNumber = cs(x, y).FormattedValue
Hopefully that might lead you in the right direction!
您需要使用 CellSet 的 Cells 属性,Axes 仅获取标签。类似于:
如果您希望显示具有多维数据集格式化规则的值,请使用
.FormattedValue
。我发现使用 cs.Axes[0].Positions 比使用元组成员更容易。
You need to use the Cells property of the CellSet, Axes only gets the labels. Something like:
Use
.FormattedValue
if you want the value with the cubes formatting rules for display.I found it easier to use
cs.Axes[0].Positions
rather than the tuples member.